wordpress - category__not_in not working

后端 未结 3 1296
心在旅途
心在旅途 2021-01-14 00:19

I\'m having a problem getting my query function. I need to run the loop, excluding a particular category.

I\'m trying to use category__not_in, but is no

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 01:03

    Try using tax_query instead :

     'post',
        'post_status' => 'publish',
        'posts_per_page' => 9,
        'paged' => get_query_var('paged'),
        'tax_query' => array(
            array(
                'taxonomy' => '',
                'field'    => 'term_id',
                'terms'    => array( 44 ),
                'operator' => 'NOT IN',
            ),
        ),
    
      );
      $query = new WP_Query( $args );
    
      query_posts($query);
    ?>
    

提交回复
热议问题