Prevent Spam Comments In Your WordPress Blog
August 4th, 2008We all hate spam. If you own a WordPress blog, and you have comments enabled (which is recommended), you will get spam in your comments. But there’s good news…there are several easy steps you can take to prevent spam comments in your blog.
First thing, activate Akismet.
Akismet is a fabulous plugin that usually comes pre-installed in the latest versions of WordPress. You’ll need to follow the directions to get an “API Key” – but it’s well worth the effort to do this. As of the writing of this post, Akismet has protected my own blog from over 12,000 (twelve thousand!) spam comments. On all the blogs I develop for my client I activate this automatically – it’s super duper important to insure a pleasant blogging experience.
When you get a new comment, Akismet will scan it and if it thinks it’s spam, it will hold it in the Comments Section under Akismet Spam. From there, you can label it spam, or just let it be deleted on it’s own. I tend to label it as spam to help Akismet do it’s job better and better.
Second thing, watch for patterns in IP addresses.
You may notice that you get a series of spam comments all at once. If this happens, you can add the IP address of the spammer to your blog’s blacklist. Here’s what it looks like:
See how all of the IP addresses are identical. This is the IP address of a blog spammer, a very bad person! So let’s put him/her on a blacklist, so they’re automatically labeled as spam the next time.
Just copy the IP address and paste it here:
This is found under “Settings” and “Discussion”. It feels good to do it, so if someone sends me multiple spam comments, it’s what I do to exact a little revenge.
Block Access To Your Website via .htaccess.
The third thing you can do (and this is only for those of you who know how to create and manipulate a .htaccess file) is to block their IP address from visiting your website. Now, IP addresses do change over time, and so this method might work for a period of time, but the spammers will eventually change their IP addresses and send more spam out. But sometimes you just want to stop them right now. This happened to me one evening when this person kept sending me these super long spam comments one after another (and I get an email when I receive comments) which really started to annoy me. So I added their IP address to my .htaccess file to block access to my website.
Here’s the code:
#Spam Prevention
order allow,deny
deny from 98.197.1.75
allow from all
This .htaccess code works on DreamHost servers…your webhosting configuration may differ and uploading a bad .htaccess file will crash your website – so proceed with caution if you try this yourself. But again, this person kept sending me spam over and over and I needed them to stop!
So for most of you, the important thing to remember is that spam is a part of internet life, and if you’re using a WordPress blog, you’ve got some nice tools at your disposal to limit the amount of spam you receive. Remember to activate Akismet immediately and be diligent about labeling things that are held for moderation as spam so that Akismet gets better and better over time.
Jill--------------
J. Olkoski
Aldebaran Web Design, Seattle
Jill Olkoski has a BS in Engineering, a BS in Computer Science and an MA in Clinical Psychology. She delights in using her advanced technical and psychological skills to help small business owners develop cost-effective and successful websites.
February 24th, 2009 at 4:22 pm
Thanks for the quick tip! It has reduced my spam considerably.