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 am working on my first WP site and am having some difficulty. In my theme's index.php page, I see the following code:

  'category__not_in' => array($headline),
  'post__not_in' => $postnotin,
  'paged' => $paged,
  'numberposts' => 5
if ( have_posts() ): $postCount = 0; ?>
<?php while ( have_posts() ) : the_post(); $postCount++;?>
[more code....]

So - you see I'm trying to limit the number of posts on the home page to 5, which I thought was the default. Anyways, it is showing more than 5 and I can't seem to get it to work. I've tried "posts_per_page" without luck. If my theme is overwriting it, any ideas where that may be?

FWIW, I'm using the initiator theme by colorlabs


share|improve this question
numberposts is the old parameter, you should be using posts_per_page. Right now, I believe they are identical in function, but numberposts is depreciated, so you cannot count on it to be available with the next release of wordpress. – mor7ifer Apr 25 '12 at 1:41
Thanks, m0r7if3r. Updating it with posts_per_page doesn't work either. I have a feeling the theme is over writing it. I don't want to do some php counting hack but am about ready to... – julie p Apr 25 '12 at 2:08
Have you checked the appropriate filters and actions? – mor7ifer Apr 25 '12 at 2:18
This will get you started. You may just want to print_r( $wp_filter )` and look at everything, but that's gonna generate a massive list that may or may not be of use to you. – mor7ifer Apr 25 '12 at 2:57
Add your solution as an answer, with working code, and mark the question as answered. Thanks! – toscho Apr 25 '12 at 5:38
up vote 0 down vote accepted

here's what I ended up doing:

'category__not_in' => array($headline),
'post__not_in' => $postnotin,
'paged' => $paged,
'posts_per_page' => 5
if ( have_posts() ): $postCount = 0; ?>
<?php while ( have_posts() ) : the_post(); $postCount++;
if ($postCount < 6) {
[all my code]

<?php } #end if ?> 
<?php endwhile;?>
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.