If you have a self-hosted WordPress blog which is quite popular, the most annoying thing is fighting WordPress comment spam on a regular basis. Every time you login to WordPress dashboard, you see a whole lot of spam comments waiting to be deleted. Either you have to delete them manually or let them die in the spam queue.

The latter option is not recommended as it will increase database size and the resource loading time. Hence, you have to find and fight your way to prevent spam comments in WordPress. This article describes some of the proven techniques which can be used to reduce WordPress comment spam.

Before we go any further, let’s understand what exactly is a spam comment.

A spam comment is a comment which is posted automatically in blogs, websites, forums etc by automated bots, scripts or software. Some people use scripts and automated bots to target high traffic websites for posting comments. Typically, a spam comment is full of irrelevant keywords and hyperlinks and does not care about the discussion or article where the comment is posted.

In short, a spam comment is an evil form of shameless self-promotion and trying to get quick links for traffic or SEO.

If you are getting lots of spam comments in your WordPress blog, here are some techniques which can help:

1. Install Akismet WordPress Plugin

Akismet is considered as the best WordPress plugin to reduce comment spam. The plugin checks each and every comment, pingbacks and trackbacks submitted in your blog and runs critical checks on the Akismet web service to determine whether the comment is a spam or not.

In addition to blocking spam comments and bad links, Akismet shows a stats page where you can see more details on the amount of comments blocked, accuracy, dates etc.

2. Close comments on Older Posts

Using Akismet is good but overtime you will find that Akismet is blocking hundreds of spam comments every week. You have to delete those spam comments manually, which is really a boring job. If you want even more control over the spam comments, consider blocking comments on older posts.

Spammers target posts which receive good traffic and you can automatically close comments on posts which are certain days old. Login to your blog’s administration area and go to Settings > Discussion. Next, select the checkbox “Automatically close comments on article older than” and enter the number of days in the text box (for example 90).

This ensures that the comments are closed on any article which is older than the number of days specified by you.

3. Ban Spam IP Addresses

Wp-Ban is a useful WordPress plugin which can be used to blacklist IP addresses who try to post spam comments in your blog. The plugin checks the IP address of the commentator and if you have already specified the same IP address in plugin settings, the commentator is shown a custom banned message.

Once you activate the plugin, keep an eye on the IP addresses of the spam comments. Next, add the IP addresses in the plugin blacklist and bingo! You will find that the number of spam comments are reducing as IP blacklist increases.

This plugin should be used with caution. If you blacklist an IP address, any visitor coming from the same host name would not be able to view your blog. Use this plugin to blacklist certain IP’s if they appear too frequently and post vulgar comments in your blog.

4. Use a Custom WordPress Function to Ban Empty Referrers

On most of the occasions, spam commentators never visit your blog and you can use this principle to drastically reduce comment spam.

Log in to WordPress administration area of your blog and go to “Theme Editor”. Select your blog’s theme and open the functions.php file for editing. Paste the following code:

The above function checks the “referring source” of the page on which the comment in posted. In case of spam comments, if the referring source is found to be empty the comments are never allowed to be posted and thus you do not receive any spam. Thanks to Internet Techies for the tip.

5. Use Recaptcha WordPress Plugin

As mentioned by Google in their Webmaster central blog, the Recaptcha WordPress plugin is one of the best ways to prevent WordPress spam comments in your blog. The concept is really simple – anyone trying to post a comment have to see a graphic and type the words matching the graphic. The spam bots do not have eyes and mind and thus can’t see and read those graphics. Hence they can’t post those intrusive comments.

The recatcha plugin serves the purpose well, but it has a major disadvantage. The regular commentators of your blog would have to fill up the catcha when they try to post a comment. This may appear discouraging or confusing to the visitor and he may refrain from posting comments altogether. Many popular blogs use Recaptcha, but I am not a fan of this plugin as this may offend the regular commentators.

Switching your comment system to Disqus or IntenseDebate (From the editor)

In MakeTechEasier, we have switched our comment system to Disqus and I guess it is worth a mention here.

Disqus is a third party comment system and moderation tool for your site. There are several benefits in using Disqus. First, they integrate closely with Askimet to reduce spams. Secondly, it help you to reduce your database size as all the comments are stored in their server. Thirdly, it integrates with Facebook, Twitter and OpenID so your readers can easily log in with the minimum hassle. Last but not least, it is free.

When you have a site with huge traffic counts and spam counts, you will appreciate how easy Disqus makes your life.

Those were some (if not all) of the techniques which you can use to prevent spam comments in your WordPress blog. What techniques do you prefer? Do you use any WordPress plugin which I may have missed out? Please share your ideas in the comments section.

Soumen is the founder/author for Ampercent, a tech blog that writes on computer tricks, free online tools & software guides.

Our latest tutorials delivered straight to your inbox