WordPress.org

Ready to get started?Download WordPress

Forums

Query presenting one compulsory category, plus array of optional cats (1 post)

  1. amucklow
    Member
    Posted 3 years ago #

    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);

Topic Closed

This topic has been closed to new replies.

About this Topic