Uma área de pesquisa sobre o WordPress para devs e autores do tema



cat_is_ancestor_of ›

Desde2.1.0
Obsoleton/a
cat_is_ancestor_of ( $cat1, $cat2 )
Parâmetros: (2)
  • (int|object) $cat1 ID or object to check if this is the parent category.
    Required: Yes
  • (int|object) $cat2 The child category.
    Required: Yes
Retorna:
  • (bool) Whether $cat2 is child of $cat1
Definido em:
Codex:

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.



Fonte

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