Get the number of posts from the current page results

I found the solution. I was looking for:

$wp_query->post_count

And some of my assumptions were not correct. This is the actual output:

Total posts from the loop 22. Posts per page 10. 1 sticky post.

  • Page 1 gives 10 (9 + 1 sticky).
  • Page 2 gives 10.
  • Page 3 gives 2.

Leave a Comment