2023.6.13 当前文章多个分类

当前 文章 多个分类 获取 多个父级分类并输出
$category = get_the_category();
foreach($category as $categories) {
$category_name = get_category($categories)->name;
$cat_parent_id = $categories->category_parent;
if (!empty($cat_parent_id != 1)) { echo get_category($cat_parent_id)->name.',';}
}
(NG) »
相关文章