WordPress.org

Make WordPress Core

Ticket #13481: 13481.diff

File 13481.diff, 714 bytes (added by ryan, 4 years ago)
  • wp-includes/taxonomy.php

     
    16261626                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) 
    16271627                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); 
    16281628                        $term_id = (int) $wpdb->insert_id; 
     1629                } elseif ( is_term( (int) $term_id, $taxonomy ) )  { 
     1630                        // Same name, same slug. 
     1631                        return new WP_Error('term_exists', __('A term with the name provided already exists.')); 
    16291632                } 
    16301633        } else { 
    16311634                // This term does not exist at all in the database, Create it.