Title: query_posts from multiple categories?
Last modified: August 20, 2016

---

# query_posts from multiple categories?

 *  [clinton4](https://wordpress.org/support/users/clinton4/)
 * (@clinton4)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/query_posts-from-multiple-categories/)
 * Hi,
 * I’am trying to use this code to get posts from category id 34 and 26 in a page
   template.
 * `query_posts( array( 'category' => array(34,26), 'posts_per_page' => -1, 'orderby'
   => 'title', 'order' => 'ASC' ) );`
 * But this query returns ALL posts from ALL categories. What am i doing wrong?

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/query_posts-from-multiple-categories/#post-2601123)
 * [http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
 * for instance:
 *     ```
       query_posts( array( 'category__in' => array(34,26), 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘query_posts from multiple categories?’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/query_posts-from-multiple-categories/#post-2601123)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
