WordPress.org

Make WordPress Core

Ticket #5809: 5809.diff

File 5809.diff, 838 bytes (added by greuben, 7 years ago)
  • wp-includes/taxonomy.php

     
    19481948                }
    19491949        }
    19501950
    1951         if ( $term_id = term_exists($slug) ) {
     1951        $term_id = term_exists($slug);
     1952        $other_tax_exists = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) );
     1953       
     1954        if ( $term_id && !$other_tax_exists ) {
    19521955                $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A );
    19531956                // We've got an existing term in the same taxonomy, which matches the name of the new term:
    19541957                if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && $exists = term_exists( (int) $term_id, $taxonomy ) ) {