0

When I use "category__not_in" it works - but the query is reversed.

$args = array (
   'post_type'        => array( 'post' ),
   'post_status'      => array( 'publish' ),
   'category__not_in' => array( 74, 77 ),
   'posts_per_page'   => '6',
   'paged'            => $paged
);

Maybe anyone had the same problem before and has a tipp? ("order" and "orderby" does not help)

EDIT: I misunderstood something, I have to use "post__not_in" instad ;)

3
  • 2
    Note that queries like this that say what you don't want are expensive and don't scale
    – Tom J Nowell
    Nov 22, 2016 at 16:11
  • Thanks for the tipp, I wasn't sure about the performance! I do this now with a extra custom post type ;). Nov 22, 2016 at 16:27
  • A custom taxonomy would also work ( if you ever write a meta query, you have the same problem )
    – Tom J Nowell
    Nov 22, 2016 at 16:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.