cat_is_ancestor_of

函数


cat_is_ancestor_of ( $cat1, $cat2 )
参数
  • (int|object)
    $cat1
    ID or object to check if this is the parent category.
    Required:
  • (int|object)
    $cat2
    The child category.
    Required:
返回值
  • (bool) Whether $cat2 is child of $cat1.
定义位置
  • wp-includes/category.php
    , line 246
引入
2.1.0
弃用

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.

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