WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add paging to the query below. However, I can't seem to get the paging to work. It shows previous/next links, however, they always show the same 2 posts. There are 8 posts in this query.

//$paged = get_query_var( 'page' );

global $post;

$args = array('posts_per_page' => 2,'paged'=>1);
$posts = get_posts($args);
share|improve this question
You are overwriting any pagination variables with 'paged' => 1, it's not a boolean flag but the current page indicator. – Horacio Nuñez Apr 23 '12 at 18:08
up vote 1 down vote accepted

If you make paged equal to get_query_var( 'paged' ) that should do the trick. You may need to do something like $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; and then set paged to $paged.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.