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 );

If you have any questions or would like to discuss a topic, tweet me @geewiz or join the chat on my Discord server!