How we can fix the result of wordpress count_user_posts function? We just have results for authors. Nothing is being counted for co-authors. Any idea to bypass this issue?
Any idea to fix this issue? This is a bit urgent because all posts that were written by two authors are not being counted to the co-author. The people are claiming with some reason.
Many thanks for your help and support.
Sorry, I’ll take a look at this when I have a moment
I did some testing on this and partially confirm the results but not entirely.
When I first activate the plugin, the results produced by count_user_posts() are inaccurate. Co-authors are actually stored as terms under the ‘author’ taxonomy. Their post count is the ‘count’ column in the term_taxonomy table. I think our activation script isn’t up to par and these post count values aren’t properly updated until the post is saved again.
Could this explain what you’re seeing, or can you clarify further with how your data is inaccurate?
@agomendes Any chance you could provide screenshots too? Thanks
Improved how user post counts are calculated in this ticket. Improvements will be available in v2.6.
If you have screenshots to indicate where you’re getting stale numbers, it would be great for ensuring what I’ve committed fixes your problem.
Thanks for the 2.6 update, Daniel. I really like this plugin and hope to start using it soon. Right now this post count issue is the only thing holding me back.
So the problem I run into is that once active, the post counts on my author templates are only counting those posts where the author is a co-author. So without the plugin active, my own author template looks like this: http://cl.ly/1D2n1H3D0H2v1e3l1U1B but after activation it looks like this: http://cl.ly/3C2H0X1h2f2I3t3v3d30. My author archive itself is http://wpcandy.com/author/ryanimel.
Right now I’m using this in the template: https://gist.github.com/1514035
Hope that helps — if there’s other information you’d like to have to debug it, just let me know.
Thanks Ryan. This should actually be fixed in v2.6 because we’re filtering the function. You can also use count_user_posts().
If the number appears inaccurate, can you go to a post where you’re an author or co-author, hit update, and see if the post count is changed?
Ah, fantastic Daniel, thanks. I should have thought to update a post so the filter can run. That issue’s fixed for me, and I’m happily using it now 🙂
Awesome, glad to hear it works 🙂
- The topic ‘[Plugin: Co-Authors Plus] count_user_posts function not counting co-authors’ is closed to new replies.