Are you a blogger? and using WordPress, then you might be aware of the spam flood which is very common on every blog now a days. Just what we need to do is a little more tweaking to stop these useless comments. In WordPress there are many ways to stop such type of comments.

I will give some tips before discussing the real issue and its prevention.

  • Always use captcha software with your comment form.
  • Disable comments on your old blog posts, this can be automatically done through WordPress Admin section. Settings -> Discussion , you can change the days here Automatically close comments on articles older than **yy** days. yy = number of days
  • Do not automatically approve comments for new users. Check Settings -> Discussion -> Before a comment appears, you can choose settings there.
  • Mark all the spam comments as Spam in Comments section.
  • Settings -> Discussion, you can set all the necessary options there to prevent spam.

Ok, that were some tips to make the things little under control. Now lets discuss how to prevent these spams in detail.

Every theme i guess have functions.php file where every necessary function is located and called by the theme for use. Go to your theme directory and check the theme you are using either it have it or not. If not, create one on your local pc and paste the following PHP code in it.

function verify_comment_spam_flood_referrer() {
  if (!wp_get_referer()) {
    wp_die( __('You cannot post comment at this time, may be you are spamming our blog!.') );
add_action('check_comment_flood', 'verify_comment_spam_flood_referrer');

The above function checks the referring source of the page on which the comment is posted. If it is found empty, in most of the cases it will be stopped from posting a comment. Now upload this file to your theme directory through FTP/SSH.

Recommended Plugins:

1- Akismet Plugin

Akismet plugin is available from the WordPress admin section to install. You will need api key to activate this plugin. I personally don’t use it because of its spam filter, some time it will catch the real comments and which of course no one wants.

2- Ban Spam IP Addresses

Another plugin to filter spam by IPs. Wp-Ban is useful in many ways and not in many also. You can blacklist IPs and by doing that, that IPs will not be able to post any comments in future on your blog posts. You can filter spam IPs from the comments and blacklist it, add it to Wp-Ban.

But this plugin has this drawback(i would say, as nothing is perfect), if you blacklist an IP, a visitor from the same host name would not be able to view your blog. Use this plugin with very care. Blacklist the IPs, which post vulgar comments frequently.

3- Use of Good Captcha Plugin

Recaptcha from Google can be considered in this case.

SI CAPTCHA Anti-Spam is another good captcha plugin.

4- Switch to third Party Comment Systems

The most used comment system is Disqus to me. But IntenseDebate can also be considered.

Update : I recommend wpDiscuz.

Ok, now what i use and recommend. I use the above PHP code in my functions.php file and SI Captcha. Before using the function, i received a lot of spam comments, which make it hard for me to look for the real comments and delete the rest. But now, the spam ratio dropped to almost .01%, a great success i would say. Hope, it would help you to at least reduce the spam rate.

Good luck!