Some days after you launch your website, you will notice a lot of comments from spam bots. These are very annoying and often target a certain post of the blog. The comment title consists of links and the body has some spam links and text. Spammers not only spam in comments they also steal your website content and spread it all over the web that is another reason why its important to protect wordpress from spam.
There are two kinds of method used by spammers:

Automated spam-bots : – Spammers use such as program and tools (robots) that can automatically submit large numbers of spam comment to numbers of blog in no time.

Manual Spam : -Well in this case spammers visit your site and manually post their spam comments in the comments field.

Spam Comments are a fact of life for bloggers, and no one can stop Spam Comments 100%, You can only minimize that to a lower level by using some tricks below to fight the spam on your wordpress website.

1-Install Akistmet

First thing you should is , install Akismet. Akismet is great plugin and is shipped with wordpress by default. You will need a key for it to work. Once you get the key , you are done. Be sure to have a look at spam comments sometimes. Akismet can sometime throw a valid comment into the spam queue. You can check here,
how to install the akismet plugin

2-Stop Access to Wp files  through .htacess

There is another useful snippet which can be added to your .htaccess file to prevent spam bots from direclty accessing your wp-comments.php. Here is the code

RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

3-Install Captcha

Another trick to get rid of spam is to install a captcha plugin like recaptcha with your comments form. This way you can prevent bots from commenting.

4-Stop Content Stealing

If someone is trying to steal your content by RSS feed you can stop its access by writing some code in .htaccess. For doing this, you first have to find out the ip of the website was stealing your content . This can be done by pinging that site, like ping on cmd prompt gives you ip of Go to that site and find out the Rss feed link and then replace the link  in the code below with that feed link and the ip with the ip of the offending site. This code is meant for .htaccess

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^
RewriteRule ^(.*)$

5-Stop no Referrer

Another trick and the final comment spam stopping technique we’re going to look at is denying comment posting to no referrer requests. It means that  if the comment isn’t coming from a valid referrer,  then it gets blocked. Make sure you change the url in line four in the snippet below  to your blog.

RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.** [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

You can also use a code snippet in functions.php to stop comments that have no refferer, Paste the code given below

<code>function</code> <code>check_referrer() {</code>
<div><code>    </code><code>if</code> <code>(!isset(</code><code>$_SERVER</code><code>[</code><code>'HTTP_REFERER'</code><code>]) || </code><code>$_SERVER</code><code>[</code><code>'HTTP_REFERER'</code><code>] == </code><code>""</code><code>) {</code></div>
<div><code>        </code><code>wp_die( __(</code><code>'Please enable referrers in your browser, or, if you\'re a spammer, bugger off!'</code><code>) );</code></div>
<div><code>    </code><code>}</code></div>
<div><code>add_action(</code><code>'check_comment_flood'</code><code>, </code><code>'check_referrer'</code><code>);</code></div>

6-Get Rid of Captchas – Use Keypic

If you find CAPTCHAs to be as annoying as I do and do not want to sacrifice your site’s security, Keypic may be the solution for you. Kaypic can protect your login forms, registration forms, forum comments and any other form you can imagine for your WordPress site. If you want a complete anti-spam solution without the annoyance of traditional front-end security methods, beat the bots with Keypic’s NO CAPTCHA Anti Spam plugin for WordPress.

Keypic checks your forms against the Keypic Web Service to see if they look like spam or not and lets you review the spam it catches under your blog’s “Comments” admin screen. Keypic protect also your login form from brute force dictionary attachs, your registration form from unwanted spammers and generally all the forms you can imagine

Yumna Tatheer

I am a Computer Science graduate and a part time blogger from Lahore, Pakistan. I am a PHP programmer and a wordpress expert.

More Posts

Follow Me: