如何在ACF分类字段中返回未使用(0个计数)术语的分类列表

时间:2019-05-14 15:10:17

标签: wordpress advanced-custom-fields taxonomy-terms

我有一个针对CPT的自定义分类法设置,该自定义分类法是州列表。每个州应只与一个州相关联。我已经使用ACF元框来处理大部分此类操作。我希望使用下面的过滤器将术语列表限制为仅计数为0 /为空的术语。

https://www.advancedcustomfields.com/resources/acf-fields-taxonomy-query/

这就是我所拥有的。我需要将空的术语ID传递到$tlist中。

function my_taxonomy_query( $args, $field, $post_id ) {

$args['orderby'] = 'count';
$args['order'] = 'DESC';
$args['include'] = $tlist;

return $args;
}
add_filter('acf/fields/taxonomy/query/name=state', 'my_taxonomy_query', 10, 3);

0 个答案:

没有答案