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

A newbe wp_query question: I set a wp_query as follows, but instead of 17 posts I only get the first 10 posts from the selected Category with ID=5. Is there an implicit paging directive on the results?

    $myPosts = new WP_Query(); 
    $args_posts = array('cat' => 5);
    while ($myPosts->have_posts()) : $myPosts->the_post();          
            <div class="post">                  
            <h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
            <div class="cover"><a href="<?php the_permalink(); ?>" rel="bookmark,nofollow" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;h=80&amp;w=120&amp;zc=1" width="120" height="80" alt="<?php the_title(); ?>" /></a></div>
            <?php } ?>
            <p><?php the_excerpt(240, __('read more &raquo;')); ?></p>              
            <?php endwhile;             


share|improve this question
I found the argument $query = new WP_Quer('nopaging=true'); but I am not sure it works – p.a. Jul 17 '12 at 12:15
up vote 2 down vote accepted

If you want to get all the pages instead, you should add posts_per_page'=>-1 to your query

You can have a look at the Wordpress Codex http://codex.wordpress.org/Class_Reference/WP_Query

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.