Ever wonder how to get rid of spam comments all in one go? Here are a couple of methods you can use to clean up your WordPress comments.

Reminder: it’s always a good idea to take a backup of your site before doing anything major like deleting comments, just in case you change your mind or accidentally delete real comments and not just spammy ones.

Use a Plugin

If you’ve let dozens, hundreds, or even thousands of comments (yes, it can happen) accumulate on your site, a quick way to get rid of them is by installing a plugin like Delete All Comments.

Here’s what to do:

Go to Plugins in your WordPress dashboard and click “Add New.”

Search for “Delete All Comments.” Install the plugin and Activate it.

Then, go to Tools > Delete Comments. Check the radio button for “Delete all comments which mark as Spam” and click Delete Now.

Delete all comments plugin settings screenshot

Voila! Your site is all fresh and clean. Make sure you adjust your Discussion settings to prevent future spam comments – skip to instructions.

Advanced: Delete with Database Command

Feeling techy? It’s easy to delete unapproved comments directly through phpMyAdmin. If you don’t know what that is, do not attempt this method! This is for advanced users only.

Here’s what to do:

The way to delete spam comments through phpMyAdmin is to delete the comments that have not yet been approved. If you have spam comments that have already been approved, you will need to use another method. Before doing this method, make sure you approve any non-spam comments.

Log in to phpMyAdmin.

Make a backup of your database just in case.

Look for the phpMyAdmin icon (under databases) and click on it. You should see a page like that when you are in the phpMyAdmin page

Select your WordPress database by clicking on it on the left. You will see a list of tables within that database.

Next, locate the tabs on the right side, and find “SQL”. Click on that.

Run the Following SQL command on your database:

DELETE FROM wp_comments WHERE comment_approved = '0'
Screenshot of phpMyAdmin running an SQL command
Advanced users can use this method to remove unapproved comments directly in the database through phpMyAdmin

Click ok on the “do you really want to… DELETE FROM…” message popup

You should see a status message saying something like “153 rows affected”. The number of rows will vary with how many comments were removed.

Log back in to your WordPress admin panel, and you will find all the pending comments gone! Hurray!

Adjust Settings to Prevent Spam Comments

Now that your website is squeaky clean and rid of spam, let’s make sure it doesn’t happen again!

Option 1: Turn off comments
If you aren’t interested in receiving any comments, turn them off in the Discussion settings like this:

Discussion settings for turning off comments in WordPress
Click the image to view it larger. Use these settings if you want to disable future comments on your website.

Option 2: Use Akismet Anti-Spam plugin
If you want to encourage comments — but not spammy ones — install and activate Akismet Anti-Spam plugin. You will also need to choose a plan (free and paid versions available).


Category:
Tutorial, WordPress