Samuel Lin
Samuel Lin

Reputation: 99

Remove wordpress comments counter in Admin dashboard

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. Comment Counter still not reset

Upvotes: 0

Views: 1053

Answers (3)

Samuel Lin
Samuel Lin

Reputation: 99

In my case, as soon as new comments came in, the old counter disappear. The comment counter will just revert back to normal.

Upvotes: 0

Bhavik Hirani
Bhavik Hirani

Reputation: 2016

For that pending comments you have to approve or reject to remove counter..! you can use Bulk Actions for Approve at once ..!

enter image description here

Upvotes: 0

Balázs Varga
Balázs Varga

Reputation: 1856

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 )

WP Codex

Upvotes: 2

Related Questions