Today, a client came to us with a problem she couldn’t bear any longer.
Spam can be annoying, but people usually don’t receive it that much or set up prevention measures on time.
However, in this case, the situation got out of control.
The client’s WordPress website had 475000 spam comments, something I’ve never witnessed before.
But luckily for her, she requested help at the right place.
Our professional team of WordPress developers has a lot of experience, and the numbers didn’t scare us out.
We simply took the challenge and assured the client that their issue is solvable, and their WordPress spam issues will stop once and for all.
Let’s see how we approached this.
How do I delete thousands of spam comments on WordPress?
Start with Akismet
By default, WordPress doesn’t prevent spam comments.
The commenting system is working pretty well in WP, however, there is no built-in mechanism that checks and prevents spam.
If the amount of WordPress comments is relatively small, you can manually check each and every comment, marking the problematic ones as spam.
However, if you have hundreds or even thousands of comments to go through, this can be a tedious job.
That’s where automation comes into the place, and our preferred tool is Akismet.
Depending on whether your website is commercial or not, you may have to donate a bit in order to get the Akismet key, but in case you have thousands of comments, it’s definitely worth it.
Once you sign up for the Akismet key and install it on your website, you can go back to your comments screen in WordPress, and you will notice some things have improved.
The most important feature at this stage is to check for spam, and Akismet does a great job at this:
Simply click the “Check for Spam” button, and see how magic starts happening:
On sites with a relatively low amount of comments, this is a very fast and straightforward process.
However, if you have thousands or as in this case hundreds of thousands of comments to go through, that’s a large bite even for Akismet.
Simply give it time, and enjoy as Akismet does the hard job for you.
In our case, it took almost three days to go through 475219 pending comments, which is rather good timing, considering it would take us weeks or months to do it manually.
Please also note that online processes like this can be stopped from time to time.
It can happen due to internet connection problems, temporary server issues, or a clogged Akismet network.
This is why you need to monitor the spam checking process from time to time.
If you notice that percentage numbers are hanging, simply refresh the comments page and hit the “Check for spam” button again.
How do I remove spam comments?
Once Akismet is done checking and classifying all of the pending comments on your website, you can start deleting those marked as spam.
Simply navigate to the “Spam” section and hit the “Empty Spam” button:
The page will reload, and during the process, all of your spam comments should be gone.
However, this is an ideal situation where you have less than a thousand comments.
Most servers have a limit and can run scripts for a certain period of time(30s for example).
Once that limit is hit, the script will get blocked and the operation stopped.
An error like this won’t hurt your website but will require you to repeat the process several times.
In our case, the script was able to delete around 5000 spam comments per cycle.
That’s why we decided to use a helper plugin that saved us from hitting the “Empty Spam” button ~100 times.
How do I delete hundreds of thousands of spam comments in WordPress?
Desperate times need desperate measures, and in this case, the best measure we could think of was the “Delete Pending Comments” plugin.
It’s a neat plugin that can delete thousands and hundreds of thousands of comments without breaking a sweat.
And more importantly in our case, it can do the same to the spam comments.
In fact, you can’t separate the two- it will delete all pending comments, spam comments, and trashed comments.
This is why we advise you to take a backup of your database first.
That way you can always restore in case anything goes wrong.
Once installed and activated, this plugin can be accessed by going to WP Dashboard->Comments->Delete Pending Comments:
Which should present you with a screen like this:
Copy-paste the given verification sentence into the box below it(“I am sure I want to delete all pending comments and realize this can’t be undone”), and then hit the “Delete Pending Comments” button.
The process should last a couple of seconds, after which you should get a confirmation message like this:
Wasn’t that a quick and neat way of deleting several hundreds of thousands of spam and pending comments in WordPress 🙂
We didn’t have this issue, but some fellas pointed out that their comment numbers aren’t updated after this process.
Before thinking that something went wrong, try clearing your browser cache or eventually log in again from an incognito browser.
How to fight spam without Akismet?
We truly love this plugin, but for a variety of reasons, we understand it may not be the best solution for you.
It could be simply not working, or you may have a commercial website and no intention to pay for the Akismet API key.
In that case, we advise you to take a look at some of the following plugins:
- Uses Google reCAPTCHA to protect comments, registration, and form submissions.
- Can automatically detect and move to spam or deny spammy comments.
- Have a plethora of other security benefits and tools for your WordPress website.
- Another tool that fights well with spam in WP.
- Has a global spam database against which your comments are checked.
- Unfiltered comments then get checked with the self-learning neural network.
- Has a pro version that can check the existing comments for the spam(like Akismet).
- Full stats on comments and spam protection.
- Checks the comments for unsecured and malicious content.
- Specifically targetted at fighting spam with various methods.
- Has lots of methods that can be used to protect various parts of your site(think comments, forms, checkout pages, etc).
- Can be used in conjunction with Akismet and other security plugins.
There are many more, but this list should get you started. Additionally, you can do your own research through the WordPress plugins repository.
Why am I getting so many spam comments on my blog?
It’s now covered how to remove spam comments from your website.
But how does it happen in the first place?
Even if you have a low amount of visitors, you can still get thousands of spam comments.
This is because nowadays there are lots of bots that scan the internet for comment boxes.
They are trying to insert their website link for marketing purposes.
And of course, they are completely missing the point and annoying people.
So to never have to worry about spam again, you should prevent it.
How to stop spam comments in WordPress?
Once again, Akismet comes in very handy in situations like this.
Simply go to WordPress Dashboard->Settings->Akismet Anti-Spam:
and you should be presented with a screen like this:
Enter your API key if you haven’t already, tick the boxes according to your preferences, and hit the “Save Changes” button.
This will make sure that spam gets into the spam folder automatically, without you having to worry about it or classify it.
Of course, few spammy comments may get away through Akismet, but they will still end up in the pending folder, and you will be able to mark them spammy manually.
How do I stop people from commenting on WordPress?
In some cases, and for a variety of reasons, some people don’t need or simply don’t want to have comments available on their site.
If that’s the case, you simply need to disable comments on your WordPress website.
Just go to WordPress Dashboard->Settings->Discussion:
and you should be presented with a screen like this:
In order to prevent people on your blog from commenting, simply untick the “Allow people to submit comments on new posts”, then hit the save button(at the very bottom of that page with comment settings).
Furthermore, you can make your own blacklist, through which you can block commenters based on name, email, IP address, and also any keyword within their comment content.
For this, there are two handy sections called “Comment Moderation” and “Disallowed Comment List”:
How you use either of the areas is pretty much the same.
The main difference is that the first one will put matched comments into pending ones, while the second section will put matched comments directly into the trash.
How do I stop people from commenting on a specific post in WordPress?
Sometimes, you may want to allow comments on your website, except for one or a few posts that are of a different kind.
In that case, you can alter the post-specific settings for comments, which are available for each post from their edit screen.
Go to edit the post in question, scroll down to the very bottom of the edit post screen, and you should see something like this:
Untick the “Allow comments” checkbox, save the post, and comments will be disabled on that post from that point.
Of course, this function works both ways, so if you have posts disabled for your entire site(check the previous section), you can still go to edit some of the posts and enable comments on them.
Hopefully, you learned a bit on how to delete large amounts of spam in WP, as well as how to prevent spam comments in their knees.
Furthermore, we shared a few tips that might come in handy if you decide to disable comments on your website or some of your posts.