Title: Multiple Category Requirement in Loop
Last modified: August 19, 2016

---

# Multiple Category Requirement in Loop

 *  [L. Littlefield](https://wordpress.org/support/users/lchelak/)
 * (@lchelak)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/multiple-category-requirement-in-loop/)
 * Hi!
 * I’d like to make a requirement for multiple categories for the select posts to
   be displayed. Here’s the part of my loop I need to adjust.
 *  <?php query_posts(array(‘category_name’ => uncategorized, ‘showposts’ => 2));
   if (have_posts()) : while (have_posts()) : the_post(); ?>
 * I need posts with both the uncategorized and nightlife categories checked.
 * How can I best do this?
 * Much thanks,
    Lara

Viewing 1 replies (of 1 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/multiple-category-requirement-in-loop/#post-1080713)
 * from [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
 * > Display posts that are in multiple categories. This shows posts that are in
   > both categories 2 and 6:
 * `query_posts(array('category__and' => array(2,6)));`

Viewing 1 replies (of 1 total)

The topic ‘Multiple Category Requirement in Loop’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [custom loop](https://wordpress.org/support/topic-tag/custom-loop/)
 * [multiple](https://wordpress.org/support/topic-tag/multiple/)
 * [requirement](https://wordpress.org/support/topic-tag/requirement/)
 * [the-loop](https://wordpress.org/support/topic-tag/the-loop/)

 * 1 reply
 * 2 participants
 * Last reply from: [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * Last activity: [16 years, 12 months ago](https://wordpress.org/support/topic/multiple-category-requirement-in-loop/#post-1080713)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
