Taxonomy: Take 'parent' into account when checking for terms with duplicate names.

Terms with duplicate names are not allowed at the same level of a
taxonomy hierarchy. The name lookup introduced in [34809] did not
properly account for the 'parent' parameter, with the result that
the duplicate-name restriction was tighter than intended (terms
with duplicate names could not be created at different levels of
a single hierarchy).

Props mikejolley.
Fixes #39984.
Built from https://develop.svn.wordpress.org/trunk@40145


git-svn-id: http://core.svn.wordpress.org/trunk@40084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2017-03-03 02:50:41 +00:00
parent 5ac6ecab48
commit ac6a3c76e4
2 changed files with 2 additions and 1 deletions

View File

@ -2040,6 +2040,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
$name_matches = get_terms( $taxonomy, array(
'name' => $name,
'hide_empty' => false,
'parent' => $args['parent'],
) );
/*

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40144';
$wp_version = '4.8-alpha-40145';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.