Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress获取不在自定义分类术语中的帖子_Wordpress_Custom Taxonomy_Notin - Fatal编程技术网

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我不确定,但你应该试试