If you check the documentation for WP_Query
you will notice that post_count
, which you are using, returns the number of posts being displayed. That is what you see, but not what you want. found_posts
returns the total number of results for the query, which is what you want.
$post_count
The number of posts being displayed.$found_posts
The total number of posts found matching the current query parameters
Note that if your query runs with 'no_found_rows' => true
the found_posts
value will be 0, and there is a found_posts
filter that can effect the result as well.