If you are an active WordPress admin for multiple sites, then I’m sure you are very accustomed to having 100’s or 1000’s of SPAM comments being sent to your blog. This post will show you exactly how to mass delete pending comment SPAM from your WordPress website in one fell swoop.
Sure there are all sorts of ways to prevent comment SPAM on your WordPress site. There are plugins, scripts, and other 3rd part add-on’s that do a great job of this.
There are many instances where you need to delete all of the pending comments at once. WordPress makes this extremely difficult to do. It is also extremely hard on the server when it starts to get into 5000+ pending comments and may crash your system.
Here is the safest, most effective way to delete pending comments from your WordPress site. Note/Disclaimer – any time you use PHPmyadmin you run the risk of causing harm to your website. Always back up your data before making any changes or following the steps in this post.
Step 1. Back up your entire website. Do this by backing up your .sql database and home directory in cpanel or whatever admin panel your host is using.
Step 2. Identify the WordPress site with the pending comments.
Step 3. Activate phpMyAdmin by clicking on the icon in cpanel.
Step 4. Locate the database with the pending comments and click the SQL tab on top. Once you’ve done that, input the following command:
SELECT *FROM wp_comments WHERE comment_approved ="0"
Step 5. You will now see the amount of rows selected which should be equal to the number of pending comments you have.
Step 6. Click on the “show query box” and input this command to delete the selected rows (comments):
delete from wp_comments WHERE comment_approved ="0"
Step 7. If everything went well, you should see a screen that looks something like this:
Feels good, right?
If you want to make sure your database is ok, then make sure you repair and optimize your database using the optimize command in phpMyAdmin, which is a few extra steps.
If you don’t want to go this route there are plugins that will do this for you, or you could just delete them manually using the WordPress back end but depending on the number of comments this could take a very long time.
For your convenience, we’ve recorded a video walk through that will take you through the same steps shown above:
(enlarge video for best results)
If you enjoyed this post, check out a similar post on deleting those old WordPress post revisions that show up under old posts and pages.