父分类ID
-
如何获取WordPress中当前分类的父分类ID?
在WordPress中,要获取当前分类的父分类ID,可以使用get_category()函数结合parent属性。,,“php,$current_category = get_category( get_query_var( ‘cat’ ) );,$parent_id = $current_category˃parent;,`,,这样,$parent_id`变量就包含了当前分类的父分类ID。