Function: count_many_users_posts

count_many_users_posts( array $users, string | array $post_type, boolean $public_only )

Number of posts written by a list of users.

Parameters

Name Type(s) Default Value Description
$users array

Array of user IDs.

$post_type string | array 'post'

Optional. Single post type or array of post types to check. Defaults to 'post'.

$public_only boolean false

Optional. Only return counts for public posts. Defaults to false.

Returns

array

Amount of posts each user has written.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.