Pagination – Same list of posts in every page issue !

As per Wikipedia, Pagination is the sequence of numbers assigned to pages in a book or periodical.

In WordPress, we generally use WP_Query or query_posts to fetch posts and display the list with pagination. A simple query would look like this:

<?php query_posts('posts_per_page=3'); ?>

This will work just fine in most of the cases but sometimes we hear issues that the pagination is not working properly or pagination numbers are correct but every page shows the same list. It’s mostly because we haven’t included the ‘paged‘ parameter to the query. The following is taken from WordPress Codex.

you add the parameter like this:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

query_posts('posts_per_page=3&paged=' . $paged); 

The next example is exactly the same as above but with the parameters in an array:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
  'posts_per_page' => 3,
  'paged' => $paged


Detailed information about how to properly configure and work with WordPress Pagination can be found in the WordPress Codex.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s