您可以使用get_the_tags
功能,大致如下:
$posttags = get_the_tags();
if ($posttags) {
echo (count($posttags) > 1) ? \'Tags: \' : \'Tag: \';
$links = array();
foreach($posttags as $tag) {
$links[] = sprintf(\'<a href="%s">%s</a>\', get_tag_link($tag->term_id), $tag->name);
}
echo implode(\', \', $links);
}
参考号:
https://codex.wordpress.org/Function_Reference/get_the_tags