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.
定义位置
相关方法
term_is_ancestor_ofget_post_ancestors_get_post_ancestorsget_ancestorshas_custom_logo
引入
2.1.0
弃用
-

cat_is_ancestor_of: 这个函数用来检查一个类别是否是另一个类别的祖先。它需要两个参数:子类别ID和父类别ID。它返回一个布尔值,表明父类别是否是子类别的祖先。

检查一个类别是否是另一个类别的祖先。

你可以使用ID或者类别对象作为两个参数。如果你使用一个整数,类别将被检索出来。

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

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 18:32:58

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: