WordPress.org

Make WordPress Core

Ticket #5809: 5809.03.diff

File 5809.03.diff, 859 bytes (added by imath, 7 years ago)
  • src/wp-includes/taxonomy.php

     
    24952495                                }
    24962496                                $term_id = (int) $wpdb->insert_id;
    24972497                        }
    2498                 } elseif ( $existing_term['name'] != $name ) {
    2499                         // We've got an existing term, with a different name, Create the new term.
     2498                } elseif ( $existing_term['name'] != $name || term_exists( $slug ) ) {
     2499                        // We've got an existing term, with a different name or the slug exists in another taxonomy, Create the new term.
    25002500                        $slug = wp_unique_term_slug($slug, (object) $args);
    25012501                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) {
    25022502                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);