Support » Fixing WordPress » Comment count always zero

  • Resolved Susan


    The comment count on my blog is zero for every post even those that have 1, 2 or more comments.

    All of these functions think there are no comments:

    but.. all the comments are still displayed properly.

    I have no idea how to fix this. Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • webgirl


    Will mind sharing how this was resolved?



    I have the same issue after importing a xml backup, but I found a solution:

    Paste this in your functions.php in your theme’s folder:

    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;

    This works beautifully!

    I’m sharing this solution on all the other unresolved threads and on blogs I found (in my search for this solution) where other people are having this problem but couldn’t find a fix.

    I experienced the same problem when importing a WordPress 2.5 export into WordPress 2.9

    Thanks for the solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Comment count always zero’ is closed to new replies.