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?


1 Answer 1


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.