WordPress.org

Ready to get started?Download WordPress

Codex

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

Difference between revisions of "Function Reference/cat is ancestor of"

(Usage: added a note about strings not being coerced to integers. made some language more specific)
m
Line 14: Line 14:
   
 
If arguments are string representations of integers and not true integers '''cat_is_ancestor_of''' will return false.
 
If arguments are string representations of integers and not true integers '''cat_is_ancestor_of''' will return false.
  +
  +
[[Category:Functions]]

Revision as of 02:45, 13 January 2008

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.