Title: Use query_posts with multiple post_ids?
Last modified: August 19, 2016

---

# Use query_posts with multiple post_ids?

 *  [ramonhimera](https://wordpress.org/support/users/ramonhimera/)
 * (@ramonhimera)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/)
 * I have scoured everywhere but cannot find the answer to a simple question.
    I
   would like to pass multiple post_ids to query_posts() and have tried… query_posts(‘
   post_id=1,2,3,4’) but it doesnt work. I know you can pass multiples to get_post()
   but this doesnt support pagination. Please can you tell me if query_posts() supports
   multiple ids?
 * Many Thx

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

 *  [Aesqe](https://wordpress.org/support/users/aesqe/)
 * (@aesqe)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801239)
 * You could check the query construct in ‘query.php’, in ‘wp-includes’ folder, 
   but from what I’ve been able to decipher, query_posts(p=ID) works only for a 
   single post…
 *  [andreacimatti](https://wordpress.org/support/users/andreacimatti/)
 * (@andreacimatti)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801389)
 * this is exactly what i’ve been trying to do for the past 3 hours. no luck yet.
 *  [buchannon](https://wordpress.org/support/users/buchannon/)
 * (@buchannon)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801390)
 * Did you ever figure this out? I could use it as well…
 *  [andreacimatti](https://wordpress.org/support/users/andreacimatti/)
 * (@andreacimatti)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801393)
 * What I did is I put the query_posts through a loop with a variable $postid
 * query_posts(‘post_id=$postid’)
 * it is not pretty but it works
 *  Anonymous User
 * (@anonymized-473288)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801394)
 * You need to use ‘is_single’ and then do your query.
 * [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * ‘2.4 A Single Post Page’ in the table of contents on the right.
 * Edit: or create a single template. See [http://codex.wordpress.org/Theme_Development](http://codex.wordpress.org/Theme_Development).
   You can create one for a single post id, or multiple id’s by using the ‘is_single’
   function.
 * Of course if you want you can create more complex queries.

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

The topic ‘Use query_posts with multiple post_ids?’ is closed to new replies.

## Tags

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

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 5 replies
 * 5 participants
 * Last reply from: Anonymous User
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/use-query_posts-with-multiple-post_ids/#post-801394)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
