Support » Themes and Templates » Query presenting one compulsory category, plus array of optional cats

  • I want to run a query for posts that are in a) a single compulsory category and b) in any of a selection of others.

    Something like this is what I was thinking might be possible – so the posts HAVE to have the $catID category, AND be in at least one of the array of other category IDs.

    $args = array(
    	'showposts' => 20,
    	'paged' => $paged,
    	'category__and' => array($catID, array(34,35,48))
    	);
    
    query_posts($args);
  • The topic ‘Query presenting one compulsory category, plus array of optional cats’ is closed to new replies.