Wordpress获取不在自定义分类术语中的帖子
下面的代码应该获得在自定义分类法中没有特定术语的文章。目前,它仍然得到他们。有东西不见了Wordpress获取不在自定义分类术语中的帖子,wordpress,custom-taxonomy,notin,Wordpress,Custom Taxonomy,Notin,下面的代码应该获得在自定义分类法中没有特定术语的文章。目前,它仍然得到他们。有东西不见了 $args = array( 'numberposts' => '3', 'post__not_in' => $post_not_in, 'tax_query' => array( 'taxonomy' => 'topic', 'terms' =&g
$args = array(
'numberposts' => '3',
'post__not_in' => $post_not_in,
'tax_query' => array(
'taxonomy' => 'topic',
'terms' => 9,
'field' => 'id',
'operator' => 'NOT IN'
)
);
$extras = get_posts($args);
重要提示:tax\u查询采用tax查询参数数组(采用数组数组)
-
你试过了吗
$args = array(
'numberposts' => '3',
'post__not_in' => $post_not_in,
'tax_query' => array(
array(
'taxonomy' => 'topic',
'terms' => 9,
'field' => 'id',
'operator' => 'NOT IN'
)
)
);
$extras = get_posts($args);
那么,如何获得没有指定分类法的帖子呢?(即terms=>空?@knutole我不确定,但你应该试试