Title: query_posts &#039;cat&#039; excluding everything
Last modified: August 20, 2016

---

# query_posts 'cat' excluding everything

 *  [nathanael.montgomery](https://wordpress.org/support/users/nathanaelmontgomery/)
 * (@nathanaelmontgomery)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/query_posts-cat-excluding-everything/)
 * I’m attempting to include only posts from category 13 & 14. I’ve tried the following
   method as well as excluding posts from all other categories and using category__and
   => array (13, 14). With both methods, I end up with nothing showing.
 * `query_posts (array( 'post_type' => 'theme_portfolio', 'showposts' => $portfolio_items_num,'
   paged'=>$page, 'order'=> 'ASC', 'cat'=>13, 14));`
 * Any ideas would be greatly appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/query_posts-cat-excluding-everything/#post-2559233)
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
 * have you tried `'category__in' => array(13,14)`
 *  Thread Starter [nathanael.montgomery](https://wordpress.org/support/users/nathanaelmontgomery/)
 * (@nathanaelmontgomery)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/query_posts-cat-excluding-everything/#post-2559256)
 * I did, in fact, I finally found my answer, although I’m not sure exactly why 
   it works,
 * `'portfolio_category' => 'Cat1'`
 * I figured it out after taking a look at this defined a little later in the code:
 *     ```
       echo "<li class=\"";
                   $myterms = get_the_terms($post->ID,'portfolio_category');
                   foreach ($myterms as $myterm ) {
                    echo $myterm->slug."\n";
                   }
                   echo "\">";
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘query_posts 'cat' excluding everything’ is closed to new replies.

## Tags

 * [?cat](https://wordpress.org/support/topic-tag/cat/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * 2 replies
 * 2 participants
 * Last reply from: [nathanael.montgomery](https://wordpress.org/support/users/nathanaelmontgomery/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/query_posts-cat-excluding-everything/#post-2559256)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
