Title: Multiple loops using WP_Query()
Last modified: August 19, 2016

---

# Multiple loops using WP_Query()

 *  Resolved [RGlover](https://wordpress.org/support/users/rglover/)
 * (@rglover)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/multiple-loops-using-wp_query/)
 * So, I’m trying to do multiple loops on one page. This is (usually) easily done
   using WP_Query() as follows:
 *     ```
       $my_query = new WP_Query('post_name=about&post_type=page&showposts=1');
       ```
   
 * No problem, in theory. In fact, this very thing has been working fine in multiple
   places for me.
 * However, it would seem that this functionality is somewhat broken in the current
   version of wordpress. In any case, the data that these loops bring back isn’t
   correct. It doesn’t seem to parse post_name into the query string. I expect the
   above query to be parsed something like this:
 *     ```
       SELECT * FROM wp_posts WHERE post_name = 'about' AND post_type = 'page' COUNT 1
       ```
   
 * Instead, every instance of WP_Query returns exactly the same data. It ignores
   the first term, and returns all of the posts marked as pages. If I remove that
   term, it returns all of the posts.
 * It’s driving me mad. Anybody got any ideas?

Viewing 1 replies (of 1 total)

 *  Thread Starter [RGlover](https://wordpress.org/support/users/rglover/)
 * (@rglover)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/multiple-loops-using-wp_query/#post-1152201)
 * AH HA! Sorting through the WP_Query class turns up that they’ve changed the variable
   name I was looking for from post_name to pagename. Changing that now returns 
   the appropriate data in the loops.
 * Hopefully that helps someone else.

Viewing 1 replies (of 1 total)

The topic ‘Multiple loops using WP_Query()’ is closed to new replies.

## Tags

 * [multiple loops](https://wordpress.org/support/topic-tag/multiple-loops/)
 * [the-loop](https://wordpress.org/support/topic-tag/the-loop/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 1 reply
 * 1 participant
 * Last reply from: [RGlover](https://wordpress.org/support/users/rglover/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/multiple-loops-using-wp_query/#post-1152201)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
