#31677 closed defect (bug) (invalid)
count_user_posts is not working in wordpress 4.1
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.1 |
Component: | Posts, Post Types | Keywords: | reporter-feedback needs-testing |
Focuses: | Cc: |
Description
count_user_posts have two parameters.
- User ID
- Post Type.
There is a note in codex - Note : Since 4.1 it supports post types.
But when I am using this function in my recent wordpress version i.e. 4.1 it is not giving me proper output.
Codex Url - http://codex.wordpress.org/Function_Reference/count_user_posts
Change History (8)
#1
@
10 years ago
- Component changed from General to Posts, Post Types
- Keywords reporter-feedback added
#2
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
No feedback in 5 months. Feel free to reopen with more information if there's still an issue.
#3
@
8 years ago
- Resolution worksforme deleted
- Status changed from closed to reopened
I am having problems too. The function is accepting a second parameter, but it seems to ignore it. I am calling the function as follows:
<?php echo count_user_posts($author_id, $post_type);
This always results in the amount of posts for the default post type being returned, instead of the actual count for the supplied post type.
I am using Wordpress 4.8
#5
@
8 years ago
- Keywords needs-testing added
@jberculo ,@SergeyBiryukov,
<?php echo count_user_posts($author_id, $post_type);
Works for me, I tested with echo count_user_posts('1', 'product');
it gave me perfect count for post type product. Please check for the same and let me know if i am missing.
Thanks.
stark.manish - Can you please give additional details? Exactly how are you calling
count_user_posts()
? What do you expect to get as a return value? And what are you in fact getting?