Prevent Spam Comments in WordPress

Posted on 25th July, 2013 36 Comments

This is a very popular subject indeed and to be honest I’m not surprised. For the most this is one of those things that you just have to put up with if you have an online presence. But thankfully there are a few things that you can do to make it near impossible for these spam whores from raping your comments.

So the first thing we can do is open up the .htaccess file in your main WordPress server folder, using an ftp client or your cpanel. Open it up in notepad or any text editor (NOT MS WORD!).

 

Block the Robots…

Add the following few lines at the bottom of our file.

### Deny Spambots ###
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*domain-name.co.uk.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]
</IfModule>

All this does is check to see if the comment comes from a human or a spam bot (if the comment has a referrer). If it’s from a spam bot then the comment gets blocked automatically.

 

Block the humans

This ones even simpler to solve than the robots; You have a few options here, using particular plugins and online services like akimet, but personally I prefer the free option. I’ve been using this plugin for about 3 years now and can count the amount of spam I’ve had come through on one hand.

Invisible capture

Believe me when i say that this is all you’re going to need.

Honestly this should come built in as a part of WordPress, there is no capture code to fill in, it does all the work in the background like a sneaky spam ninja.

LionScripts: IP Blocker Lite

ip blocker

This little baby will allow you to block persistent spammers by allowing you to add and block their IP address. But from personal experience spammers will change their own IP or use a dynamic IP witch will bypass this blocker, so this one is up to you.

Comments

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]

Durekbah

08th, Oct, 20

You stated it adequately. best essay writing service canada [url=https://discountedessays.com/]good thesis statement[/url] psychology dissertation topics

Durekbah

10th, Oct, 20

Amazing information, Cheers! websites that write essays for you [url=https://englishessayhelp.com/]xyz homework[/url] write dissertation proposal

Durekbah

11th, Oct, 20

This is nicely said! ! freedom writers movie review essay [url=https://service-essay.com/]paper writing[/url] define dissertation paper

MelviFug

12th, Oct, 20

Nicely put. With thanks!
canadian viagra [url=https://canadianpharmacyfirst.com/]drugs for sale[/url] canadian pharmacies without an rx

Direkbah

13th, Oct, 20

You actually expressed this very well. write my essays [url=https://scoringessays.com/]online dissertation[/url] dissertation structure

DwayneDethy

13th, Oct, 20

Seriously loads of very good facts! northwest pharmacy/com [url=https://rxpharmacymsn.com/]canada drugs[/url] prescription online

MelviFug

14th, Oct, 20

You revealed it effectively.
cialis canada [url=https://canadiantoprxstore.com/]global pharmacy canada[/url] canadian pharmacy cialis

Durekbah

14th, Oct, 20

Fine forum posts. Kudos! custom essays essay help [url=https://scoringessays.com/]paper helper[/url] edit dissertation

MelviFug

16th, Oct, 20

Cheers. An abundance of stuff.
approved canadian pharmacies online [url=https://cadmedbb.com/]canadian pharmacies that ship to us[/url] global pharmacy canada

Direkbah

16th, Oct, 20

Kudos. Quite a lot of info.
how to write essays fast [url=https://dissertationwritingtops.com/]help writing thesis[/url] dissertations & theses

DwayneDethy

17th, Oct, 20

Seriously lots of excellent material. best online canadian pharcharmy [url=https://canadianmsnpharmacy.com/]ed drugs[/url] drugstore online

Durekbah

17th, Oct, 20

Fantastic info, Regards. how to write a lit essay [url=https://essayssolution.com/]help writing thesis[/url] define dissertations

Direkbah

19th, Oct, 20

Nicely put, Regards. we write essays [url=https://homeworkcourseworkhelps.com/]writers help[/url] dissertation marks

DwayneDethy

19th, Oct, 20

Nicely put, Kudos! walmart pharmacy price check [url=https://canadianpharmacysaverx.com/]list of legitimate canadian pharmacies[/url] canada medication pharmacy

Leave a Comment

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]