WordPress 中文文档

Function Reference/cat is ancestor of

From WordPress Chinese

Jump to: navigation, search

Description

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

Usage

%%% <?php cat_is_ancestor_of(cat1, cat2); ?> %%%

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.

用户