WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/cat is ancestor of

Description

This is a simple function for evaluating if the second category is descended from of another category.

Usage

 <?php cat_is_ancestor_of(cat1cat2); ?> 

Returns true if cat1 is an ancestor of cat2. Any level of ancestry will return true.

Arguments should be either integer category IDs or category objects.

Notes

If arguments are string representations of integers and not true integers cat_is_ancestor_of will return false.