Check if a category is an ancestor of another category.

You can use either an id or the category object for both parameters. If you use an integer the category will be retrieved.

Signature

cat_is_ancestor_of( $cat1, $cat2 )
cat1
 (int|object) ID or object to check if this is the parent category.
cat2
 (int|object) The child category.

Return

(boolean) Whether $cat2 is child of $cat1

Source

function cat_is_ancestor_of( $cat1, $cat2 ) {
	return term_is_ancestor_of( $cat1, $cat2, 'category' );
}
WP Trac GitHub

Link here