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.

git-svn-id: https://develop.svn.wordpress.org/trunk@40145 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2017-03-03 02:49:13 +00:00
parent 8a2341335b
commit d3e463cb84
2 changed files with 36 additions and 0 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'],
) );
/*