wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



cat_is_ancestor_of › WordPress Function

Seit2.1.0
Veraltetn/v
cat_is_ancestor_of ( $cat1, $cat2 )
Parameter: (2)
  • (int|object) $cat1 ID or object to check if this is the parent category.
    Erforderlich: Ja
  • (int|object) $cat2 The child category.
    Erforderlich: Ja
Gibt zurück:
  • (bool) Whether $cat2 is child of $cat1.
Definiert in:
Codex:

Checks 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.


Quellcode

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