Make WordPress Core

Ticket #31270: 31270.patch

File 31270.patch, 520 bytes (added by tyxla, 11 years ago)

In wp_insert_term() when initially figuring out a slug, make sure that existing term is considered only on the current term level.

  • src/wp-includes/taxonomy.php

     
    28602860        if ( ! $slug_provided ) {
    28612861                $_name = trim( $name );
    28622862                $existing_term = get_term_by( 'name', $_name, $taxonomy );
    2863                 if ( $existing_term ) {
     2863                if ( $existing_term && $existing_term->parent == $parent ) {
    28642864                        $slug = $existing_term->slug;
    28652865                } else {
    28662866                        $slug = sanitize_title( $name );