Function Reference/count many users posts
Returns the post counts for a list of user IDs. This is an O(n) operation, so it is preferred over count_user_posts() any time more than a single count is needed.
<?php count_many_users_posts( $users, $post_type, $public_only ); ?>
- (array) (required) List of ID values of the users whose post counts should be retrieved.
- Default: None
- (string) (optional) Name of the post type
- Default: null
- (string) (optional) Bypasses checking capabilities of current user (False) or returns posts only if they can be viewed by current user (True).
- Default: False
- Amount of posts each user has written.
The call to count_many_users_posts returns the number of posts made by each user.
$users = array(1, 3, 9, 10);
$counts = count_many_users_posts($users);
echo 'Posts made by user 3: ' . $counts;
Posts made by user 3: 143
- 3.5.0: Added the public_only parameter
- Since: 3.0.0
count_many_users_posts() is located in