Title: Infinite loop issue?
Last modified: September 1, 2016

---

# Infinite loop issue?

 *  Resolved [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/)
 * Hi,
 * If I have 10 posts, and scrolling down with Ajax Pagination already installed
   and configured, after loading the 10th post and scrolling again, instead of stop
   it shows again all of them starting from the 1st one again. The post list never
   stops despite reaching the last post.
 * Do you know how to solve this issue?
 * Thank you in advance.
 * [https://wordpress.org/plugins/malinky-ajax-pagination/](https://wordpress.org/plugins/malinky-ajax-pagination/)

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

 *  Plugin Author [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * (@malinkymedia)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649248)
 * Hi, thanks for your message. This normally occurs when the next selector isn’t
   correct. You need to make sure that your targeting the next page css class specifically.
   What can happen if targeting the wrong link that the paging will loop between
   the next page and previous page so it continues to load the same posts.
 * Do you have a site demo for me to take a look? Otherwise could you send me theme
   file your working from.
 * Thanks
 *  Thread Starter [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649250)
 * Hi,
 * It´s running at [http://www.nuevaletusa.es/actualidad](http://www.nuevaletusa.es/actualidad)
 * Thank you.
 *  Plugin Author [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * (@malinkymedia)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649251)
 * Thanks. Yes it’s as I mentioned the pagination you’re using creates a loop. So
   after going to the next page the selector .center-list a.prev-next then becomes
   a link to the previous page so the plugin keeps loading the next and then the
   previous page.
 * In your theme template I’d replace the pagination function you’re using with 
   this.
 * `the_posts_pagination();`
 * Then update two of the plugin settings to this.
 * Navigation Selector .navigation
    Next Selector .nav-links a.next
 * Thanks
 *  Thread Starter [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649252)
 * Hi,
 * I´m not sure what I need to do regarding replacing the pagination function at
   my theme. Do you mean call that function just typing `function the_posts_pagination();`
   at my child´s theme functions.php file? Making this the site doesn´t load anymore.
   Please let me know if I need to do something else.
 * About the selectors, I was using:
 * The selector that wraps all of the posts/products:**.x-main**
    The selector of
   an individual post/product: **.post** The selector of the post/product navigation:**.
   x-pagination** The selector of the navigation next link: **.center-list a.prev-
   next**
 * If I change any of the 2 selectors you have recommended, the plugin is deactivated
   and it´s shown the regular pagination instead the Ajax Pagination preloader.
 * I hope we can find a solution.
 * Thank you.
 *  Plugin Author [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * (@malinkymedia)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649255)
 * You need to add the_posts_pagination(); into the theme template file that loads
   the page you sent me. It’s difficult for me to know without working with the 
   theme. For example the content could be loaded from archive.php, category.php
   or others.
 * The two selectors I’ve asked you to add won’t work until the pagination is loaded
   using the above function.
 * If you can zip and send me your theme files I’ll take a look but I’m struggling
   without them. I’ll need the parent and child theme. Email to [hello@wordpress-ajax-pagination.com](https://wordpress.org/support/topic/infinite-loop-issue/hello@wordpress-ajax-pagination.com?output_format=md).
 * Thanks
 *  Thread Starter [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649256)
 * Hi again,
 * I have already replied to your email.
 * Than you.
 *  Plugin Author [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * (@malinkymedia)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649260)
 * I’ve not received an email from you.
 *  Thread Starter [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649261)
 * Hi,
 * I´ve sent it to [hello@wordpress-ajax-pagination.com](https://wordpress.org/support/topic/infinite-loop-issue/hello@wordpress-ajax-pagination.com?output_format=md)
   from my Gmail account.
 * I´ll send it again, let me know.
 * Thank you.
 *  Thread Starter [Pablo](https://wordpress.org/support/users/pibo/)
 * (@pibo)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649262)
 * Message already sent. Please check your SPAM folder too.
 * Thank you.
 *  Plugin Author [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * (@malinkymedia)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649339)
 * Resolved via email.

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

The topic ‘Infinite loop issue?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/malinky-ajax-pagination_e2c6ba.svg)
 * [Ajax Pagination and Infinite Scroll](https://wordpress.org/plugins/malinky-ajax-pagination/)
 * [Support Threads](https://wordpress.org/support/plugin/malinky-ajax-pagination/)
 * [Active Topics](https://wordpress.org/support/plugin/malinky-ajax-pagination/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/malinky-ajax-pagination/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/malinky-ajax-pagination/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [craigramsay](https://wordpress.org/support/users/malinkymedia/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/infinite-loop-issue/#post-7649339)
 * Status: resolved