我正在尝试获取自定义帖子类型“资源”中的所有标签。
问题是我在循环之外并且努力寻找一种方法来获得与自定义帖子类型一起使用的功能。
我的类别设置也为“resource_category”
我目前的代码是:
$tax = 'post_tag';
$terms = get_terms( $tax );
$count = count( $terms );
if ( $count > 0 ): ?>
<div class="post-tags">
<?php
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, $tax );
echo '<a href="' . $term_link . '" class="tax-filter" title="' . $term->slug . '">' . $term->name . '</a> ';
} ?>
</div>
<?php endif;
任何人都可以帮忙吗?