Introduce term_is_ancestor_of(). Finish taxonomy support for wp_insert_category(). Props garyc40. fixes #15581

git-svn-id: http://svn.automattic.com/wordpress/trunk@19678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2012-01-04 22:44:19 +00:00
parent 5b9144b12d
commit 85304c2dc7
3 changed files with 28 additions and 20 deletions

View File

@@ -117,7 +117,7 @@ function wp_insert_category($catarr, $wp_error = false) {
if ( $parent < 0 )
$parent = 0;
if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
if ( empty( $parent ) || ! term_exists( $parent, $taxonomy ) || ( $cat_ID && term_is_ancestor_of( $cat_ID, $parent, $taxonomy ) ) )
$parent = 0;
$args = compact('name', 'slug', 'parent', 'description');