This ticket was fixed and closed in version 4.3.
Make sure you got the latest version ( currently 4.4.2 )
If we check out the inline documentation for the count_user_posts()
we find this part:
* @since 4.3.0 Added `$public_only` argument. Added the ability to pass an array
* of post types to `$post_type`.
Note the default post type for that function is post
.
So you will most likely have to add the post types you want, here’s an example:
echo count_user_posts(
$userid = 1,
$post_type = [ 'post', 'page' ],
$public_only = false
);
to get the count for the user with user id as 1 and post types post and page.