Index: wp-includes/category.php
===================================================================
--- wp-includes/category.php	(revision 19676)
+++ wp-includes/category.php	(working copy)
@@ -207,20 +207,9 @@
  * @return bool Whether $cat2 is child of $cat1
  */
 function cat_is_ancestor_of( $cat1, $cat2 ) {
-	if ( ! isset($cat1->term_id) )
-		$cat1 = &get_category( $cat1 );
-	if ( ! isset($cat2->parent) )
-		$cat2 = &get_category( $cat2 );
-
-	if ( empty($cat1->term_id) || empty($cat2->parent) )
-		return false;
-	if ( $cat2->parent == $cat1->term_id )
-		return true;
-
-	return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
+	return term_is_ancestor_of( $cat1, $cat2, 'category' );
 }
 
-
 /**
  * Sanitizes category data based on context.
  *
@@ -235,7 +224,6 @@
 	return sanitize_term( $category, 'category', $context );
 }
 
-
 /**
  * Sanitizes data in single category key field.
  *
@@ -254,7 +242,6 @@
 
 /* Tags */
 
-
 /**
  * Retrieves all post tags.
  *
@@ -277,7 +264,6 @@
 	return $tags;
 }
 
-
 /**
  * Retrieve post tag by tag ID or tag object.
  *
@@ -301,10 +287,8 @@
 	return get_term( $tag, 'post_tag', $output, $filter );
 }
 
-
 /* Cache */
 
-
 /**
  * Remove the category cache data based on ID.
  *
@@ -317,7 +301,6 @@
 	clean_term_cache( $id, 'category' );
 }
 
-
 /**
  * Update category structure to old pre 2.3 from new taxonomy structure.
  *
@@ -355,5 +338,4 @@
 	}
 }
 
-
 ?>
Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 19676)
+++ wp-includes/taxonomy.php	(working copy)
@@ -1495,6 +1495,32 @@
 }
 
 /**
+ * Check if a term is an ancestor of another term.
+ *
+ * You can use either an id or the term object for both parameters.
+ *
+ * @since 3.4.0
+ *
+ * @param int|object $term1 ID or object to check if this is the parent term.
+ * @param int|object $term2 The child term.
+ * @param string $taxonomy Taxonomy name that $term1 and $term2 belong to.
+ * @return bool Whether $term2 is child of $term1
+ */
+function term_is_ancestor_of( $term1, $term2, $taxonomy ) {
+	if ( ! isset( $term1->term_id ) )
+		$term1 = get_term( $term1, $taxonomy );
+	if ( ! isset( $term2->parent ) )
+		$term2 = get_term( $term2, $taxonomy );
+
+	if ( empty( $term1->term_id ) || empty( $term2->parent ) )
+		return false;
+	if ( $term2->parent == $term1->term_id )
+		return true;
+
+	return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy );
+}
+
+/**
  * Sanitize Term all fields.
  *
  * Relies on sanitize_term_field() to sanitize the term. The difference is that
Index: wp-admin/includes/taxonomy.php
===================================================================
--- wp-admin/includes/taxonomy.php	(revision 19676)
+++ wp-admin/includes/taxonomy.php	(working copy)
@@ -117,7 +117,7 @@
 	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');
