Title: Duplicate posts when using Infinite loop and offset
Last modified: August 21, 2016

---

# Duplicate posts when using Infinite loop and offset

 *  Resolved [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/)
 * I was trying to get jetpack’s infinite loop on my site and it’s working just 
   fine, but of course the design specified that the first 2 posts have a slightly
   different design, so I thought I could just use a wp_query like so:
 *     ```
       <?php
               $loop = new WP_Query( array(
                 'ignore_sticky_posts'  => true,
                 'offset' => 2,
               ));
             while ( $loop->have_posts() ) : $loop->the_post(); 
   
                 get_template_part( 'content' );
   
           endwhile;  wp_reset_query(); ?>
       ```
   
 * That’s all great and infinite loop works, but the next 2 posts are repeats of
   the last two. I found this thread – [http://wordpress.org/support/topic/custom-queries-and-how-to-avoid-jetpack-infinite-scroll-to-duplicate-post?replies=5](http://wordpress.org/support/topic/custom-queries-and-how-to-avoid-jetpack-infinite-scroll-to-duplicate-post?replies=5)
   
   and thought that it might be related, but since it’s 5 months old, I thought 
   I would check.
 * Is jetpack’s status still the same? If not any idea how this could be achieved?
   I tried using a counter as well instead of offset, but no joy…
 * PS: I love jetpack by the way… 🙂
 * [http://wordpress.org/plugins/jetpack/](http://wordpress.org/plugins/jetpack/)

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/?output_format=md)
[1](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/?output_format=md)
2

 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047828)
 * Thanks for bearing with me.
 * I’ll ask one of our Infinite Scroll experts to take a look. We’ll post again 
   here as soon as we have news.
 *  [maxgx](https://wordpress.org/support/users/maxgx/)
 * (@maxgx)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047829)
 * no no, thank you for your support!
 *  [maxgx](https://wordpress.org/support/users/maxgx/)
 * (@maxgx)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047833)
 * hi Jeremy, any news from the experts yet?
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047834)
 * Not yet, but I’ll post again here as soon as they get back to me!
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047835)
 * It seems I made a mistake in the code snippet I posted a few weeks ago. Could
   you try to use the `infinite_scroll_query_args` filter instead of `infinite_scroll_allowed_vars`?
 *     ```
       // Add post__not_in to IS query args
       function jeherve_is_allowed_vars( $vars ) {
       	$vars[] = 'post__not_in';
       	return $vars;
       }
       add_filter( 'infinite_scroll_query_args', 'jeherve_is_allowed_vars' );
       ```
   
 * Let me know if it helps.
 *  [maxgx](https://wordpress.org/support/users/maxgx/)
 * (@maxgx)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047838)
 * hey Jeremy, it does work!
    of course this only hides sticky posts, but the duplication
   of posts when ‘older posts’ is clicked is still there. is there any way to let
   IS count/consider a custom query rather than the standard WP loop?
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047840)
 * Could you send me an email with all the code you’ve used to build this custom
   loop? I will then check it on my own test site and see how I can help.
    [http://jetpack.me/contact-support/](http://jetpack.me/contact-support/)
 * Thanks!

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/?output_format=md)
[1](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/?output_format=md)
2

The topic ‘Duplicate posts when using Infinite loop and offset’ is closed to new
replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

## Tags

 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [infinite loop](https://wordpress.org/support/topic-tag/infinite-loop/)

 * 22 replies
 * 4 participants
 * Last reply from: [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/duplicate-posts-when-using-infinite-loop-and-offset/page/2/#post-4047840)
 * Status: resolved