WordPress Bug: Incorrect count of comments? – Solution

Yeah, I’d been noticing it over the last few days that the count of comments for the posts was incorrect. And it was consistently missing out later posts. 😐 I was unsure if the ‘bug’ existed in WordPress or it was due to the theme that I use (if that mattered).

I first thought, it probably didn’t count posts by the same person – or by the author… but that theory didn’t match for every post.

Googl’ing for the problem resulted in top 2-3 results which were tangential to my issue. So avoided that.

Tried some typical tricks… and finally, got the solution/”fix” for it: Just edit the comment for a post whose comment count is incorrect. You can simply add some character and delete it back, and then save it (Update Comment). You’ll now see that the count is corrected! 🙂

God bless the WordPress programmers! They’re doing an awesome job – albeit some bugs (they’re kinda obvious, in software development). 🙂


Luxury chocolate gifts from Hotel Chocolat

Generic CA US 300*250

3 thoughts on “WordPress Bug: Incorrect count of comments? – Solution”

  1. Did you do an Import before this problem appeared?

    There is a bug that is triggered when you do an Import (perhaps after changing hosts, for instance).

    I had this problem on a blog I support with hundreds of posts(!). But I found a real solution at:


    All you need to do is copy and paste this code at the end of your Theme’s functions.php file:

    add_filter('get_comments_number', 'comment_count', 0);
    function comment_count( $count ) {
    if ( ! is_admin() ) {
    global $id;
    $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
    return count($comments_by_type['comment']);
    } else {
    return $count;

    It fixes all the posts at once!

    1. Thanks Trisha… But no, I did not do an IMPORT before encountering the issue. I could only get it correct in the way I’ve mentioned in the blog above.

      Thanks anyway!

  2. How do you physically edit the comment numbering? There is no way to do that in WordPress. Do you mean to edit it in the database?

    Hope you can help

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.