If I do a get_posts() with category set to 1,2 I will get all posts in category 1 OR 2.
If i want all posts whit both categories, that is 1 AND 2, how do I make that request?

6 Answers
6

As documented in the codex you could use the following

$query = new WP_Query( array( 'category__and' => array( 2, 6 ) ) ); //post has to be in category with ID 2 AND 6

Leave a Reply

Your email address will not be published. Required fields are marked *