With WordPress Comment Spam increasingly becoming an issue, you might find yourself with 100’s or even 1000s of pending comments that you then need to delete. The base WordPress install only lets you “bulk delete” pending comments page by page (i.e. 20 at a time) on it’s default settings. It is not difficult to imagine that this would be very time consuming to do.
Before (or after) deleting all your pending comments you may want to consider configuring your WordPress installation to help prevent spam comments. I have created a detailed tutorial for this here.
There are a number of ways to delete all the pending comments; some more complex than offers. The easiest method is to change the default settings in WordPress itself to display 200 pending comments at any one time. If you have more than 200 comments, then the next best way is to use a WordPress plugin. I have covered these two options first.
If you are comfortable with MYSQL then you may want to follow the later methods, although I do think the plugin method is the easiest way to quickly delete the comments.
1. Delete All Pending and Spam Comments by Changing the Default Comments Per Page Setting in WordPress
By default, WordPress only lets you delete 20 pending or spam comments at a time. You can change this setting to up to 200.
2. Delete All Pending Comments in WordPress using a Plugin
Using the Delete All Comments Easily plugin is the least technical and easiest way to delete significant numbers of pending comments in WordPress. I highly recommend using this method if you have more than 200 pending comments.
3. Deleting all Pending Comments in WordPress Manually via SSH
For those a little more technically minded and don’t mind logging in via SSH and using the command line it is very easy to Delete all your Pending Comments. Just follow these instructions:
This command can be adapted with one minor change to carry out other comment related tasks:
Mass Delete all Approved Comments in WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e "DELETE FROM wp_comments WHERE comment_approved = '1';"
Mass Delete all Spam Comments in WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e "DELETE FROM wp_comments WHERE comment_approved = 'spam';"
Mass Delete all Trash Comments in WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e "DELETE FROM wp_comments WHERE comment_approved = 'trash';"
4. Deleting Pending Comments in WordPress Manually via phpMyAdmin
Another way to do this, is to use phpMyAdmin:
You can use this technique to carry out other similar tasks with just one very minor alteration to the command used:
Mass Delete all Approved Comments in WordPress via SQL
DELETE from wp_comments WHERE comment_approved = '1'
Mass Delete all Spam Comments in WordPress via SQL
DELETE from wp_comments WHERE comment_approved = 'spam'
Mass Delete all Trash Comments in WordPress via SQL
DELETE from wp_comments WHERE comment_approved = 'trash'
Jonathan Griffin Editor, SEO Consultant, & Developer.
Jonathan Griffin is The Webmaster's Editor & CEO, managing day-to-day editorial operations across all our publications. Jonathan writes about Development, Hosting, and SEO topics for The Webmaster and The Search Review with more than nine years of experience. Jonathan also manages his own SEO consultancy, offering SEO developer services. He is an expert on site-structure, strategy, Schema, AMP, and technical SEO. You can find Jonathan on Twitter as @thewebmastercom.