Changeset 14783
- Timestamp:
- 05/21/2010 04:03:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r14619 r14783 1609 1609 if ( $term_id = is_term($slug) ) { 1610 1610 $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A ); 1611 // We've got an existing term , which matches the name of the new term:1612 if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name ) {1613 // H eirarchical, and it matches an existing term, Do not allow same "name" in the same level.1611 // We've got an existing term in the same taxonomy, which matches the name of the new term: 1612 if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && is_term( (int) $term_id, $taxonomy ) ) { 1613 // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level. 1614 1614 $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) ); 1615 1615 if ( in_array($name, $siblings) ) { … … 1622 1622 } 1623 1623 } elseif ( $existing_term['name'] != $name ) { 1624 // We've got an existing term, with a different name, Creat ethe new term.1624 // We've got an existing term, with a different name, Create the new term. 1625 1625 $slug = wp_unique_term_slug($slug, (object) $args); 1626 1626 if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
Note: See TracChangeset
for help on using the changeset viewer.