WordPress.org

Make WordPress Core

Ticket #6211: same-slug-diff-taxonomy.patch

File same-slug-diff-taxonomy.patch, 858 bytes (added by nerrad, 10 years ago)

patch to be applied after removing unique index key for the slugs field in the _terms table

  • wp-includes/taxonomy.php

     
    11511151                }
    11521152        }
    11531153
    1154         if ( ! $term_id = is_term($slug) ) {
     1154        if ( ! $term_id = is_term($slug, $taxonomy) ) {
    11551155                $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) );
    11561156                $term_id = (int) $wpdb->insert_id;
    11571157        } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
     
    11611161                $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) );
    11621162                $term_id = (int) $wpdb->insert_id;
    11631163        }
    1164 
     1164       
     1165        if ( is_array($term_id) )
     1166                $term_id = $term_id['term_id'];
     1167               
    11651168        if ( empty($slug) ) {
    11661169                $slug = sanitize_title($slug, $term_id);
    11671170                $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );