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 making a custom query for posts using something like:

$p = new WP_Query(); 
$p->query(array('offset' => 30, 'posts_per_page' => 10));

If I have 36 posts on the entire blog, $p->post_count will return the number of posts that were retrieved, 6 in this case.

I need to get the post count just like I would if I omitted this 2 arguments (so I can calculate the remaining post count). How can I do that, without making another query?

share|improve this question
up vote 3 down vote accepted

The found_posts property $p->found_posts will return it.

share|improve this answer
that's it. thank you :) – Alex Nov 26 '10 at 5:34
You are welcome! – sorich87 Nov 26 '10 at 7:10

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.