有两种方法可以实现此目的:修改现有the_tags 功能或构建您自己的。
the_tags 最终依赖于get_the_term_list, 返回超链接标记的列表。您必须使用正则表达式来使用过滤器向其中添加类和样式。那会很麻烦。
所以,我的首选方法是自己构造一个函数。从array of tags 并循环通过它们:
$all_tags = wp_get_post_tags (get_the_ID(), array(\'orderby\' => \'name\', \'order\' => \'ASC\', \'fields\' => \'all\'));
$output = "";
foreach ($all_tags as $tag) {
  $tag_style =  // get that from ACF
  $tag_link  =  get_tag_link($tag->term_id);
  $tag_name  =  $tag->name;
  $output .= \'<a class="tag-button w-button" href="\' . $tag_link . \'" style="\' . $tag_style . \'">\' . $tag_name . \'</a>\';
  }
echo $output;
 注意:我没有测试这段代码,所以可能需要进行一些调试。