Title: multiple query_posts into one &quot;AND&quot;
Last modified: August 20, 2016

---

# multiple query_posts into one "AND"

 *  [JonasVorwerk](https://wordpress.org/support/users/jonasvorwerk/)
 * (@jonasvorwerk)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/)
 * I would like to know how to merge several queries into one. Now I do several 
   query_post but I should be possible with just one.
 * For example:
 * (show a certain post)
 *     ```
       $args = array(
       	'p' => 3
       )
       ```
   
 * AND
 * (show the latest 25 posts)
 *     ```
       $args = array(
       	'showposts' => 25
       );
       ```
   
 * AND
 * (show posts in categories at all times)
 *     ```
       $args = array(
       	'category__in' => array(6,7,41)
       );
       ```
   
 * Thanks in advance

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728790)
 * Based on what you’ve posted above:
 *     ```
       $args = array(
       	'p' => 3,
       	'posts_per_page' => 25,
       	'category__in' => array(6,7,41)
       );
       ```
   
 * but that wont work as you’re asking for both a single post AND 25 posts.
 *  Thread Starter [JonasVorwerk](https://wordpress.org/support/users/jonasvorwerk/)
 * (@jonasvorwerk)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728799)
 * That’s not what I’m searching for.
    The result I’m looking for is 25 last posts
   + all the posts form certain categories
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728805)
 * You’ll need 2 queries for that – 1 for the 25 latest posts and the second for
   all the posts from certain categories. You might want to have a look at [multiple Loops](http://codex.wordpress.org/The_Loop#Multiple_Loops)
   for some examples.
 *  Thread Starter [JonasVorwerk](https://wordpress.org/support/users/jonasvorwerk/)
 * (@jonasvorwerk)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728816)
 * This means duplicate posts which we don’t want..
    Thanks again!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728822)
 * Not necessarily. You could loop through the objects returned from each query 
   and weed out any duplicates before outputting the results to any page.

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

The topic ‘multiple query_posts into one "AND"’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/multiple-query_posts-into-one-and/#post-2728822)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
