wp_list_categories( [ \'include\' => wp_list_pluck( get_the_category(), \'term_id\' ) ] );
在你的
single.php
模板:
$current_cats = get_the_category();
$current_cats_ids = [];
foreach ($current_cats as $cat) {
$current_cats_ids[] = $cat->term_id;
}
wp_list_categories([
\'include\' => $current_cats_ids,
]);