WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/taxonomy.php

    r15220 r15426  
    16311631        $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A );
    16321632        // 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 ) ) {
    16341634            // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level.
    16351635            $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) );
    16361636            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']);
    16381638            } else {
    16391639                $slug = wp_unique_term_slug($slug, (object) $args);
     
    16481648                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    16491649            $term_id = (int) $wpdb->insert_id;
    1650         } elseif ( term_exists( (int) $term_id, $taxonomy ) )  {
     1650        } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) )  {
    16511651            // 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']);
    16531653        }
    16541654    } else {
Note: See TracChangeset for help on using the changeset viewer.