显示wordpress父级分类别名。

//显示父级分类别名
$category = get_the_category(); 
$category_parent_id = $category[0]->category_parent;
$category_parent = get_term( $category_parent_id, 'category' );
echo $category_parent->slug;

//显示父级分类名称
$category = get_the_category();
$parent = get_cat_name($category[0]->category_parent);
echo $parent;