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 query all posts by an author and paginate them on the author.php page. I've tried messing with the WP default blogs per page settings and that doesn't help. I've looked at other posts on here and could find a solution either. This works on my category pages and custom template pages (with the exception of the author attribute).

Here's what I have for my query:

if (get_the_author_meta( 'ID' )) {
  $authorID = get_the_author_meta( 'ID' );
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
$args = array(
    'post_type' => 'post',
    'orderby'=> 'date',
$query = new WP_Query( $args );

I even tried query_posts() with no luck.

The query itself works, but the pagination breaks. Any ideas?

share|improve this question
up vote 2 down vote accepted

There is already a query on that page. author.php is an optional template file that, if present, WordPress will use for author archives. You shouldn't have to create another query on that page. I think that your query and the native query are colliding, at least in part because both queries will be using the same paged query var.

If you need to change something about the query, you should probably be interrupting the main query for that page instead of creating a new query.

function alter_author_wpse_84696() {
  if (!is_author()) return false;
  global $wp_query;
  $wp_query->set('posts_per_page', 10);
  $wp_query->set('order', 'ASC');
share|improve this answer
Works great thank you! – dragonfeet2012 Feb 6 '13 at 16:53

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.