When I was cleaning my website from spams, I noticed a high number of comments (600+) in admin dashboard. Instead of going through one by one and deleting them, I decided to nuke all unapproved comments with this sql query:
delete from wp_comments where comment_approved = 0
Now my admin dashboard is STILL showing the same number of comments but all the actual comments are gone. How do I reset this counter back to zero.
If you prefer the SQL way, you can do:
UPDATE wp_posts SET comment_count = 0 WHERE id = id
Or you have a wordpress function: wp_update_comment_count( $post_id, $do_deferred )
In my case, as soon as new comments came in, the old counter disappear. The comment counter will just revert back to normal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.