Ticket #15741: 15741.5.diff
| File 15741.5.diff, 1.7 KB (added by , 12 years ago) |
|---|
-
wp-includes/taxonomy.php
2068 2068 $name = wp_unslash($name); 2069 2069 $description = wp_unslash($description); 2070 2070 2071 $slug_provided = $slug; 2071 2072 if ( empty($slug) ) 2072 2073 $slug = sanitize_title($name); 2073 2074 … … 2093 2094 // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level. 2094 2095 $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => (int)$parent) ); 2095 2096 if ( in_array($name, $siblings) ) { 2096 return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.'), $exists['term_id']); 2097 if ( $slug_provided ) 2098 return new WP_Error('term_exists', __('A term with the name and slug provided already exists with this parent.'), $exists['term_id']); 2099 else 2100 return new WP_Error('term_exists', __('A term with the name provided already exists with this parent.'), $exists['term_id']); 2097 2101 } else { 2098 2102 $slug = wp_unique_term_slug($slug, (object) $args); 2099 2103 if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) … … 2108 2112 $term_id = (int) $wpdb->insert_id; 2109 2113 } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) ) { 2110 2114 // Same name, same slug. 2111 return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists['term_id']);2115 return new WP_Error('term_exists', __('A term with the name and slug provided already exists.'), $exists['term_id']); 2112 2116 } 2113 2117 } else { 2114 2118 // This term does not exist at all in the database, Create it.