Dealing with spam comments on WordPress can be a real pain. If you haven’t taken the necessary steps to tighten your defenses and stop spammers in their tracks, you’ll soon find your site flooded with them.
To ensure the security of your WordPress Site and maintain your site performance, you need to take actionable steps to regularly clean up your site and remove all kinds of spam.
Let’s dig into more details about why WordPress is a common target for spammers and why you need to remove it before we look at what you can do to prevent and remove spam from WordPress.
Why Do Spammers Spam Your Site?
First things first. Why do spammers care about your site so much? Why is your website a common target for spammers?
Black hat SEO is what causes all nuisances on the internet. Spammers post comments in the hopes of getting a link in return. Chances are, they don’t even know what your blog post is about to add any kind of value through their comments. They are just using spam bots to automatically send generic, spam comments with a couple of links on them.
Since WordPress is the most popular CMS out there, it remains a common target for spam. And the more popular your website is, the more attention you’ll attract from SEO spammers.
And so, by now, you should accept spam as a fact of life and try to deal with it in the best way possible.
Why Do You Need to Remove Comment Spam on WordPress?
Why do you need to worry about the accumulating spam on your site?
For one, you wouldn’t want those unappealing comments to go live on your site. They give a bad impression to your legit visitors and commenters, affect the user experience of your site, and also get in the way of meaningful conversations to happen in the comment section.
Apart from that, spam comments with bad SEO links will affect your own site’s rankings as Google has started cracking down on bad links. Most of these comments include malicious links, which also affect the security of your site.
And so, it’s important that you take some proactive steps to prevent the flood of spam on your website and clean your site to remove these little buggers with nonsense gibberish taking up valuable space in the database.
What do Spam Comments on WordPress Look Like?
Before we dive into the different ways to remove spam comments from WordPress, it’s important to understand the difference between spam and genuine comments. At the end of the day, you’ll have to do some manual cleaning as well and so, it’s important that you can easily identify which comments are legit and which are spam so you can approve the genuine comments and weed out the spam.
Here are some spam signs to look out for:
- Using a keyword instead of the person’s real first and last name
- A generic comment that can be posted on every blog post on the internet like “nice post”, “thank you for the information”, etc.
- The email address has obvious signs of not being legit like email@email.com
Apart from these obvious cues, you would also want to consider what kind of link is posted with the comment. If it’s something you don’t want your site visitors to click on – for example, if it’s something totally unrelated to your industry – you should consider that comment as spam.
Now that it’s clear what kind of comments you should let go of, let’s dig into the different ways of removing spam and also preventing it in the first place.
Make Sure All Comments are Moderated Before They Go Live
The first thing you need to do is stop the spammers in their tracks so that those comments with nonsense SEO gibberish don’t end up on the frontend of your website. You wouldn’t want your genuine readers to back off from commenting and having a conversation with you amidst the sea of spam.
To do that, you need to change comment moderation settings so that your comments need to be approved before they go live on your site.
Go to WordPress > Settings > Discussion. Under Discussion Settings, go to the option “Before a comment appears” and make sure the first checkbox is selected, i.e. “Comment must be manually approved” and the second checkbox is unselected, i.e. “Comment author must have a previously approved comment.”
Configuring this setting lines up all comments in the moderation queue so they are manually approved before they go live on the site.
Use an Anti-Spam Plugin like Akismet
Once you’ve done the necessary configurations, the next thing you need is a mechanism that automatically flags spam comments so you don’t have to deal with hundreds and thousands of spam comments yourself. It’s not a pretty experience going down your pending comments section and marking them as spam one by one.
Akismet is by far the most popular anti-spam plugin on WordPress. It comes pre-installed on WordPress and does a good job of marking the comments as spam and blocking them from going in the moderation queue.
Akismet picks on the popular cues that tell whether the comment is spam or genuine. However, sometimes it misses out and lets a spam comment end up in the pending section or makes a legitimate comment end up in spam.
In that case, you’ll need to rescue the comments by marking them correctly yourself, which will also ‘teach’ Akismet to be more careful next time. That’s why it’s also a good idea to go through your spam comments section every 15 days to check for any ‘accidents’.
Delete Spam Comments
Now that you’re correctly routing all comment spam, you’ll need to clean up the spam section to free up space.
Though you can configure Akismet to delete spam comments when they are a month old, you may need to do it earlier than that in case some blackhat SEO spammer decided to barrage your site with thousands of SEO links.
It’s actually quite easy to delete spam comments. Go to the spam comments section and click on the Empty Spam button in the top menu to delete all spam.
However, there is a problem with this method. If your site is infested with thousands of spam comments, deleting them all together can make your site slow down and even crash your web server.
Fortunately, you have an easy way out of this problem. Read on to find out.
Delete your Spam Comments in Batches
To solve this problem, you need a plugin called Batch Comment Spam Deletion.
This plugin is available for free and can be installed by navigating to Plugins > Add New. Search for Batch Comment Spam Deletion plugin and click Install.
The plugin doesn’t have any settings to configure so you can head over straight to your Comments page after installing and activating it.
The plugin processes spam comments in batches instead of deleting them all at once. Go to the Spam Comments page and hit the Empty Spam button. Your spam comments will now be deleted in batches without taking down your site.
However, if your site is still slowing down when deleting spam comments, you may need to edit the plugin to reduce the number of comments processed in a batch. By default, this plugin processes 100 spam comments at once.
To edit your plugin, go to Plugins > Installed Plugins. Click Edit on Batch Comment Spam Deletion Plugin. Edit the plugin file and lower the number of comments that will be processed in one batch.
When done, update the file.
Delete Pending Comments
Though Akismet does its job well, spammers have become smarter today and easily figure out ways to get through your anti-spam defenses.
And so, you’ll often find your pending section barraged with spam comments that look like this: “Nice article” and “Thank you for this post”.
Unfortunately, it’s not so easy to delete the pending comments as there isn’t any convenient Empty Pending Comments button at the top.
The first thing you’ll need to do is go through your Pending Comments and approve any that look genuine.
Once you’ve done that, you can deal with the pending comments in two ways.
The Non-Technical Way: Bulk Delete Pending Comments
The first thing you need to do is change the default setting of the number of items that appear on one page so that you apply bulk actions to more items at once.
Go to Screen Options at the top of the page. In Pagination settings, increase the number of items that appear on one page from 20 to 100.
Then,use the checkbox at the top of the first column to select all comments. Use the Bulk Actions drop-down menu and choose ‘Move to Trash’. Hit the Apply button to move all pending comments to trash. You’ll need to repeat the above step for all pages of pending comments.
This method only moves the pending comments to trash, which you’ll need to empty manually by hitting the Empty Trash button on the Trash page.
The Technical Way: Run a PHP Query
A quicker way to clean up the comment spam on WordPress is through a PHP query. Go to your cPanel Account and select phpMyAdmin under the Database section.
Select the database for your WordPress installation and click on the SQL tab.
Type in the following command in the box given and hit Go.
DELETE from wp_comments WHERE comment_approved = ‘0’
Make sure your database prefix is ‘wp’. Double-check by looking at the file names on the left.
This simple command can help you delete all pending comments permanently in a quick way. You can also use this command for other tasks like deleting all approved comments, deleting spam comments, or emptying your trash.
To delete all Approved comments:
DELETE from wp_comments WHERE comment_approved = ‘1’
To delete all Spam comments:
DELETE from wp_comments WHERE comment_approved = ‘spam’
To delete all Trash comments:
DELETE from wp_comments WHERE comment_approved = ‘trash’
Using these SQL commands can help you do the cumbersome task of deleting your comments manually in a quicker and simpler way without using any plugins.
Although plugins make it easier and simpler to delete spam comments from WordPress, installing plugins comes with their own set of problems. For one, they add more doors for hackers to hack into your site, and two, they take more storage space on your server that will slow down your site.
Hence, it’s better to tackle it yourself using PHPMyAdmin as explained above, and remove spam without affecting your site speed and security. Hopefully, this post will help you remove comment spam on WordPress to get a clean and lean site that loads fast and works well.