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

No matter what, I CANNOT figure out why WP_Query pulls in all posts, and completely ignores posts_per_page ... I only want to show one post.


$args = array(
'post_type'      => 'post',
'orderby'        => 'date',
'order'          => 'ASC',
'posts_per_page' => -1

// The Query
$the_query = new WP_Query( $args );

// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();

<div style="padding: 15px;">
    <div class="grid_4 alpha">image</div>
    <div class="grid_7 omega">
        <?php the_excerpt(); ?>
<div style="clear: both;"></div>
<div style="height: 33px; background-color: #5ba4d8; position: relative;">
    <div style="width: 300px; line-height: 33px;"><?php the_title(); ?></div>
    <a href="" style="position: absolute; right: 0; top: 0;"><span class="nav-blog-next"></span></a>


// Reset Post Data
share|improve this question
up vote 6 down vote accepted

Change posts_per_page to 1 only, not -1.

Like this: 'posts_per_page' => 1

-1 means all.

share|improve this answer

From your question title, it sounds like you are trying to only pull one single post. The problem is that you have passed -1 to posts_per_page, which equates tells the query to pull in every single post.


'posts_per_page' => 1
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.