Problem with paginated query on single.php in WordPress



I have developed a WordPress site locally on apache, but online it’s running on Nginx.

Locally everything works as it should, but I have one slight problem online:

On my single.php posts, I’m querying the main loop under the post, and paginate the result (12 posts per page). This works as a charm on my local apache configuration, but online I’m running into the following problem:

It fetches the 12 first posts, but on page 2 it shows the first 12 posts once again, instead of 13-24. This goes on for every page, it only shows posts 1-12.

I’m wondering if this could be a rewrite issue or something?

This is the code I’m using below the single post to fetch the main loop:

        $page = (get_query_var('paged')) ? get_query_var('paged') : 1;  
        if (have_posts()) : while (have_posts()) : the_post(); ?>  
include (TEMPLATEPATH . '/inc/nav.php' );  

Any ideas what could be the problem?

You can see the site in question here:


// Jens.



can’t see any issue on site


Hello agin!

The issue is on single posts, not on the main page. Click on a post and check the loop under the post itself, it repeats and won’t go to page 2 in the infinite scroll. Works locally.


// Jens.


Hello @jensfilipsson ,

I hope your query is resolved. I am closing this support ticket for now.

Feel free to create a new support ticket if you have any queries further. :slight_smile: