Title: Custom loops
Last modified: August 21, 2016

---

# Custom loops

 *  [Neil Nand](https://wordpress.org/support/users/neil-nand/)
 * (@neil-nand)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/custom-loops-1/)
 * Hello,
 * This might seem like a bit of a strange question but there’s something that I’m
   finding really hard to understand so was hoping someone could clear it up for
   me.
 * If I create a separate instance of the WP_Query object for a custom loop to work
   along side my main loop, lets say this custom loop is the first thing on the 
   page, I then need to reset the loop so because my custom loop will have affected
   it?
 * Is that correct? The thing I’m finding hard to understand is that if I’ve created
   a separate instance of the WP_Query object then how is this affecting the main
   default page loop? Is it because the $post variable gets altered?
 * Thanks very much for any help, I’ve been searching for ages on the Internet for
   an answer and non of the ones I’ve found (of which there are quite a few) are
   really clearing this up for me.

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/custom-loops-1/#post-3955574)
 * Use wp_reset_postdata() for a separate instance of the WP_Query object. It restores
   the global $post variable to the current post in the main query.
 * [http://digwp.com/2011/09/3-ways-to-reset-the-wordpress-loop/](http://digwp.com/2011/09/3-ways-to-reset-the-wordpress-loop/)
 *  Thread Starter [Neil Nand](https://wordpress.org/support/users/neil-nand/)
 * (@neil-nand)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/custom-loops-1/#post-3955644)
 * Hello,
 * Thanks for the reply but I was looking for help understanding how the loop works
   and why separate instances of the WP_Query object interfere with the main loop.

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

The topic ‘Custom loops’ is closed to new replies.

## Tags

 * [Themes](https://wordpress.org/support/topic-tag/themes/)
 * [theming](https://wordpress.org/support/topic-tag/theming/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: [Neil Nand](https://wordpress.org/support/users/neil-nand/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/custom-loops-1/#post-3955644)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
