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 have the page count set to the default 10 in my reading settings menu.


However, I use my template archive.php file for all post types, including posts and books

How can I change the loop so that when searching books it will show 30 books in the archive page instead of showing the default 10?

share|improve this question
up vote 1 down vote accepted

I think something like this should work:

add_action('parse_query', 'wpse32932_parse_query'); 
function wpse32932_parse_query( $wp ){
    if( $wp->is_post_type_archive ):
        $wp->query_vars['posts_per_page'] = 30;
    return $wp;
share|improve this answer
excellent solution. thanks! – cwd Nov 8 '11 at 1:26

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.