WordPress comment count

This statement corrects all the comment count in WP posts by querying every posts actual comments:

UPDATE wp_posts p SET p.comment_count = (
    SELECT count(*) FROM wp_comments
    WHERE comment_post_id = p.id AND
       comment_approved = 1 );

4 thoughts on “WordPress comment count”

  1. How do I do that in PhpMyAdmin? I have no experience in Mysql is it possible you can give me a detailed run down how to go about it?Thank you so much

    1. “I have no experience in Mysql”

      I that case I would not recommend executing mysql commands on phpmyadmin on your own. ;-)

Comments are closed.