-
-
Notifications
You must be signed in to change notification settings - Fork 513
found_posts on new PostQuery() #1973
Copy link
Copy link
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
There is no way to get the total number of post from the PostQuery object which forces users to write things like this :
$query = new WP_Query([
'cat' => $category->id,
'post__not_in' => get_option('sticky_posts'),
'posts_per_page' => $context['offset']
]);
$context['posts'] = new PostQuery($query);
$context['found'] = $query->found_posts;Describe the solution you’d like
A method (total() or found()) on PostQuery to get the total number of post found.
Questions
Is there a reason why this feature is not implemented ? I may be able to submit a PR to implement this myself but I want to know if there was a reason for not including this in the PostQuery class.
Thanks
Reactions are currently unavailable