• I couldn’t find an adequate solution to this in the forum so am hoping that someone can help me!

    After importing posts from another wordpress blog the comment count has been set to zero, even if there are comments on a post. The comments are not disabled either.

    The comment count is working fine for all posts created since the import.

    How can I reset the comment count for the imported posts?

Viewing 8 replies - 1 through 8 (of 8 total)
  • I wonder this to. The problem is obviosly that some values are left out in the db. :f Got the same problems but with local avatars not being set to new ones for old users etc.

    Some re-count feature would fix it.

    +1 on this one. I have a blog I support where I’m seeing this.

    I had this problem today, too, and found the solution at https://www.ads-software.com/support/topic/265655

    Here is the solution:

    Add this code to 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;
    }
    }

    All fixed!

    It’s still not working for me! ??

    Thread Starter kcmartin

    (@kcmartin)

    Thank you Trisha! It worked to the extend that my posts now show the correct comment count. However, my archives still don’t for those posts that I imported, see here https://www.gipsylife.com/archives/. If you expand all posts you can see that everything after May 2009 shows a (0) count even though there are comments. I guess this now is a problem with the plug-in *sigh*. Wish I was more technical!

    Hi trishacupra, at which part in the functions.php file do I insert that code? When I pasted this code on the functions.php (removing everything that was in there first), it turns into an error message, even my blog only displays that error message. Please help? Thanks!

    Got it!

    Thanks trishacupra! it works!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘comment count zero after import’ is closed to new replies.