Changes from trunk/wp-includes/taxonomy.php at r15220 to branches/3.0/wp-includes/taxonomy.php at r15426
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/wp-includes/taxonomy.php
r15220 r15426 1631 1631 $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A ); 1632 1632 // We've got an existing term in the same taxonomy, which matches the name of the new term: 1633 if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && term_exists( (int) $term_id, $taxonomy ) ) {1633 if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && $exists = term_exists( (int) $term_id, $taxonomy ) ) { 1634 1634 // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level. 1635 1635 $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) ); 1636 1636 if ( in_array($name, $siblings) ) { 1637 return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.') );1637 return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.'), $exists['term_id']); 1638 1638 } else { 1639 1639 $slug = wp_unique_term_slug($slug, (object) $args); … … 1648 1648 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); 1649 1649 $term_id = (int) $wpdb->insert_id; 1650 } elseif ( term_exists( (int) $term_id, $taxonomy ) ) {1650 } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) ) { 1651 1651 // Same name, same slug. 1652 return new WP_Error('term_exists', __('A term with the name provided already exists.') );1652 return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists['term_id']); 1653 1653 } 1654 1654 } else {
Note: See TracChangeset
for help on using the changeset viewer.