Spam Free WordPress

Spam Free WordPress is a comment spam blocking plugin that blocks 100% of the automated spam with zero false positives. There is no other plugin, or service, available for WordPress that can claim 100% accuracy with zero false positives, not even Akismet. Manual spam is blocked with an IP address blocklist.
This plugin was born out of necessity in September of 2007 when HollywoodGrind.com was getting a lot a traffic, and with it a lot of spam that multiple plugins could not stop, but instead increased the load on the server fighting the spam. Since its birth, Spam Free WordPress has been tested successfully under real world heavy traffic, and heavy comment spam, conditions. Once Spam Free WordPress is installed, no other comment spam plugins are needed, and it is recommended that all other plugins be disabled since they will cause undesirable false positives.
It is my goal for Spam Free WordPress to help WordPress become the world’s first and only comment spam free blogging platform.
What Am I Worth?
Is a reliable spam fighting plugin worth a dollar?
Spam Free WordPress Features
- Automatically blocks 100% of automated comment spam
- Local manual spam and ban policy set with local IP address blocklist
- Global manual spam and ban policy set with remote IP address blocklist
- Significantly reduces database load compared to other spam plugins
- Zero false positives
- Option to strip HTML from comments
- No CAPTCHA, cookies, or Javascript needed
- Saves time and money by eliminating the need to empty the comment spam folder
Automatically Blocks Automated Comment Spam
Spam Free WordPress uses anonymous password authentication to block 100% of all comment spam with zero false positives. Either the password is submitted with the comment form, or it’s spam. Each post is a assigned a password. The password is generated only after it is visited for the first time, and the password only changes when a comment is left. The password is only generated and changed when necessary to eliminate unnecessary load on the database. The reader leaving a comment copies and pastes the password into the comment field to authenticate while remaining anonymous, thus eliminating the need to login to an different account on each blog. Logged in readers will not be required to use the comment form password.
CAPTCHA is not used because it is hard to read, unnecessary, easily cracked, and reduces the number of real comments substantially. There is an interesting article about CAPTCHA here.
Readers do not need to accept cookies or to have Javascript enabled for Spam Free WordPress to work. Spam Free WordPress uses anonymous password authentication the reader types into the comment form.
Automated spam bots use the wp-comments-post.php core WordPress file to submit comment spam even if the comment form doesn’t exist like when DISQUS is used to handle comments. Spam Free WordPress hooks into wp-comments-post.php to block automated spam by requiring the same password authentication used on the comment form. Spam Free WordPress eliminates the spam DISQUS users continue to experience.
Local and Remote Blocklist
Spam Free WordPress uses an IP address blocklist to block comment spam that is manually submitted by a real person. The blocklist can also be used to ban readers that leave offensive comments. The local blocklist is stored in the database, so it can be used to set policy for a local blog. The remote blocklist allows a global policy to be set for many blogs that remotely access a file that contains the IP address list.
If someone has their IP address listed in the blocklist that person can still read the blog, but will not be able to leave a comment. This approach is used for several reasons. Spam bots may spoof an IP address, or another person may have been using the IP address when they were banned. No one owns an IP address for life, so the IP address is blocked from leaving comments, but not from reading the blog.
Reduces Database Load
As mentioned above, the password is set and changed only when necessary to reduce load on the database. Other plugins filter comments in an effort to determine if they are spam.
Since it is not possible for any filter to ever identify spam accurately, their success at blocking spam is marginal. Those other plugins allow spam to be written to the database most of the time, and stored in the comment spam queue, where the blogger must manually delete the spam. Akismet will prevent some comments it believes is spam from being written to the database, and that results in complaints at times when people realize it was a real person commenting.
Spam Free WordPress knows if comments are real or not, because a password must be entered into the form manually. Anything that is submitted without the password is considered spam. Unlike a filter approach that has many variables, password authentication is 100% accurate, since the password is submitted or not.
Comments that are blocked are never written to the database, which eliminates all the load on the database that spam creates, and other plugins allow.
Option to Strip HTML from Comments
It is very common for manual and automated comment spam to include a URL that links to a web site. Spam Free WordPress has an optional feature that will automatically strip out HTML from comments so that links will show up as plain text, and will then also remove the allowed HTML tags from below the comment text box.
Cached Pages Will Work
Comment form passwords will properly refresh on cached pages, provided the cache program is set to refresh the page on changes to the page, or if a comment has been submitted. Spam Free WordPress has been tested with WP Super Cache, Batcahe, W3 Total Cache using APC, Memcache, and Xcache, with the super fast Nginx web server using its core NCache module, and PHP served with PHP-FPM, with Apache serving PHP, and with other caching programs, all of which worked properly.
Spam Free WordPress in Action

Case Study: Hacked Comment Accounts on Gawker
On Monday December 13, 2010 at 5:59 PM, Gawker sent out this email message to people who had an account on their blogs used to leave comments. It should be noted that Gawker does not use WordPress, but the security hole created by using comment accounts is the same on every blogging platform.
Gawker Comment Accounts Compromised — Important
This weekend we discovered that Gawker Media’s servers were compromised, resulting in a security breach at Lifehacker, Gizmodo, Gawker, Jezebel, io9, Jalopnik, Kotaku, Deadspin, and Fleshbot. As a result, the user name and password associated with your comment account were released on the internet. If you’re a commenter on any of our sites, you probably have several questions.
We understand how important trust is on the internet, and we’re deeply sorry for and embarrassed about this breach of security. Right now we are working around the clock to improve security moving forward. We’re also committed to communicating openly and frequently with you to make sure you understand what has happened, how it may or may not affect you, and what we’re doing to fix things.
This is what you should do immediately: Try to change your password in the Gawker Media Commenting System. If you used your Gawker Media password on any other web site, you should change the password on those sites as well, particularly if you used the same username or email with that site. To be safe, however, you should change the password on those accounts whether or not you were using the same username.
We’re continually updating an FAQ (http://lifehac.kr/eUBjVf) with more information and will continue to do so in the coming days and weeks.
Gawker Media
If Gawker had been using the anonymous password authentication built into Spam Free WordPress this incident would not have happened.
Case Study: Street Dogs Band
A blog run by the band Street Dogs recently started using Spam Free WordPress around 7-15-2011, and in just a few weeks they’ve blocked over 26,000 spam comments. Visit they’re site and refresh the page to see how fast the spam comments are hitting their server. As of 4-12-2012 Spam Free WordPress has blocked 690,070 spam comments from the Street Dogs blog.
Case Study: Raspberry Pi
Raspberry Pi builds tiny computers for educational purposes, but they will certainly be put to use for all kinds of purposes, especially since they are dirt cheap yet powerful enough to do a lot. As of 4-12-2012 Raspberry Pi has blocked 70,229 spam comments.
Comment Form Example
If Spam Free WordPress is installed correctly there will be a Password field on the comment form. Each time a reader leaves a comment they type in that password, or copy and paste it, to leave a comment. Below is an example. If the password field is not visible refer to the readme.txt file for specific directions.
To see the password field you must be logged out of your WordPress blog account.

Installation Instructions
Proper Installation Example
If Spam Free WordPress is installed correctly there will be a "Password:" field on the comment form. An example screenshot can be viewed above, or for a live example scroll down to the comment form at the bottom of this page.
To see the password field you must be logged out of your WordPress blog account.
NOTE: Clear the blog cache, like WP Super Cache, after installation.
WordPress 3.0 and Above
- Upload to the /wp-content/plugins directory
- Activate
- If the comment_form() function is already in the comments.php file, then nothing else needs to be done. Otherwise go to step 4.
- Save a backup copy of comments.php
- Go to Appearance -> Editor. Edit comments.php
- Replace the <form> and </form> tags, and all the code between the <form> and </form> tags, with the following line of code:
<?php comment_form(); ?>
- Click "Update File" to save changes.
- If the file gets messed up, use the backup comments.php code to restore everything.
Incorrect:
<form> <?php comment_form(); ?> </form>
Correct:
<?php comment_form(); ?>
If the comments.php file is custom, and it is not desirable to use the comment_form() function, then follow the directions for WordPress 2.8 or 2.9 below.
WordPress 2.8 or 2.9
- Upload to the /wp-content/plugins directory
- Activate
- Copy and paste the following line into your comments.php file right after the last form field for either the email address or the URL (web site):
<?php if(function_exists ('tl_spam_free_wordpress_comments_form')) { tl_spam_free_wordpress_comments_form(); } ?>
Thesis Theme
- Go to Thesis -> Custom File Editor, choose custom_functions.php, then click Edit selected file. Add the following line of code to that file:
add_action('thesis_hook_comment_field', 'tl_spam_free_wordpress_comments_form');
- Save changes.
Genesis Theme Framework by StudioPress
- Upload to the /wp-content/plugins directory
- Activate
Catalyst Theme Framework
- Upload to the /wp-content/plugins directory
- Activate
- Backup the comments.php file
- Replace all code in the comments.php file with the following code:
<?php global $catalyst_layout_id; if( !empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) { die( 'Please do not load this page directly. Thanks!' ); } if( post_password_required() ) { ?> <p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view comments.', 'catalyst' ); ?></p> <?php return; } catalyst_hook_before_comments( $catalyst_layout_id . '_catalyst_hook_before_comments' ); catalyst_hook_comments( $catalyst_layout_id . '_catalyst_hook_comments' ); catalyst_hook_after_comments( $catalyst_layout_id . '_catalyst_hook_after_comments' ); catalyst_hook_before_comment_form( $catalyst_layout_id . '_catalyst_hook_before_comment_form' ); comment_form(); catalyst_hook_after_comment_form( $catalyst_layout_id . '_catalyst_hook_after_comment_form' ); //end comments.php
WPtouch plugin
WPtouch uses an old comments.php file format that makes it impossible to detect that plugin’s mobile theme, or to add form fields, so they must be added manually each time the plugin is upgraded. Almost all phones today can see blog posts just like a personal computer sees them, so WPtouch is not needed, but for those who use it here is how to make it work with Spam Free WordPress.
Go to the wp-conten/plugins directory then into wptouch/themes/default. Open the comments.php file in an editor. Find the following line:
<p> <input name="url" id="url" type="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><?php _e( 'Website', 'wptouch' ); ?></label> </p>
Below that line add the following line:
<p><?php if( function_exists( 'tl_spam_free_wordpress_comments_form' ) ) { tl_spam_free_wordpress_comments_form(); } ?></p>
Support
Plugin support can also be obtained through IRC chat on irc.freenode.net in the #toddlahman channel. Click here if you need an IRC chat program.
Requirements
Self-hosted WordPress 3.0 or above. PHP 5 or above. This plugin works in Multi-User mode.
Download
Download latest version of Spam Free WordPress
| Plugin | Last Update | Rating | # Ratings | Downloads |
|---|---|---|---|---|
| Spam Free WordPress | 2012-03-26 | 91.60 | 60 | 98644 |
| Averages | 91.60 | 60.00 | 98644 | |
| Totals | 60 | 98644 |
Pingbacks and Trackbacks
The plugin below will close pingbacks and trackbacks on all posts and pages.
Directions: Activate plugin, publish or edit/update one post. All posts and pages will now have pingbacks and trackbacks disabled. Deactivate plugin. Only needs to be run once.
To make sure pingbacks and trackbacks are closed on future posts and pages, go to “Settings -> Discussion” and uncheck the box next to “Allow link notifications from other blogs (pingbacks and trackbacks).”

dw it is workimg :D
btw my theme is Annotum theme
I need help! It dosen’t work because I have no or in my comments.php code! Can someone help me?!
It works like a charm. I just got a trackback spam tonight, so I will get that trackback plugin too. Thanks so much.
Hello,
I would like to move the field labels to the right of the text fields (like your site) and was wondering if I directly edit tl-spam-free-wordpress.php to achieve this, I am going to cause a problem with the intended functionality?
Also, for some reason, the new password fields are not inheriting the styles on my site, they are touching each other, versus a little spacing above/below. Is there anyway to control this?
Regards,
Ross.
The plugin version used on this site differs from the version available for download, since it is tested here first before release.
To achieve the same look you would need to edit the plugin file.
To adjust the CSS for the form fields you can edit the plugin file, and use either a class or id to then style them in your CSS file.
The next version will have some of these features built-in, but it may be a while before I release it since I’ve been so busy. (10:30 pm on May 7, 2012)
Hi,
I would like to use the spam free WordPress plugin with the free version of the vigilance theme by Theme Foundry: http://thethemefoundry.com/wordpress/vigilance/. I can not figure out how to add the password fields into the comment form. There is no tag anywhere in the comment.php file.
I’ve put the comment.php file up at pastebin: http://pastebin.com/8yBGC6ux
The code you posted was only part of a comments.php file, and did not contain a comment form. I grabbed a copy of the Vigilance comments.php, made the modifications. If this is the right theme the code below should work.
1. Make a backup copy of your comments.php file
2. Go to this link, http://pastebin.com/FL8XURYQ, and use the code in the “RAW Paste Data” section to replace all the code in the comments.php file. (5:49 pm on May 6, 2012)
Parse error: syntax error, unexpected T_ENDIF in \\boswinfs04homeuserswebb1658ez.themydnighthourcomwpwp-contentthemesdragonskincomments.php on line 68
I tried to Replace the code and I got this error. Did I do something wrong? From the raw section, right?
Try this instead: http://pastebin.com/uEv3Rwzx (2:43 am on May 5, 2012)
http://pastebin.com/14hYutu4
As soon as I get back to a secure PC that I can trust, I will give a donation. The world goes round because of free coders like you.
1. Make a backup copy of your comments.php file
2. Go to this link, http://pastebin.com/PER0deYm, and use the code in the “RAW Paste Data” section to replace all the code in the comments.php file. (7:47 pm on May 4, 2012)
I am currently traveling in Thailand and thus unable to donate, but I just want to say fine work here. I am unfortunately having a hard time getting this to work because on my I-devices it’s hard to edit code. Your plugin has already blocked 36 or so bits of spam, but I am confused because when I visit the comments area (not logged in) it doesn’t show the password field. My site is themydnighthour.com. Does the password field not show on iPhone or iPads?
Post all of the code from your original comments.php file to http://pastebin.com/, paste a link to that code here, and I will reply with a link to pastebin with the new code for your comments.php file. (4:35 am on May 4, 2012)
Thank Heavens….! I’m waiting desperately for you to include your system to work on the WordPress Login and Registration Forms….. Must have…. pretty please soon. :)
Thank you Todd. I just skipped that portion. Installed the plugin and hope it will work fine now. Thanks.
HI again– I went to the first link—saw the “Activate” link, pushed it, and nothing happens except the print changes size slightly. Again, as I said, I’m not a whiz at this—but not totally ignorant either—I appreciate your help with this.
I would suggest contacting your WordPress host for technical support. (4:50 pm on April 26, 2012)
I just downloaded your program, and made a donation. The files have all been downloaded, BUT, I don’t seem to be able to complete step 2 on the Installment: “2. Activate” How do I do that? Thanks–I’m not a computer whiz, but I’m trying to learn how to protect my Book Webpage from the constant barrage of computer generated spam.
Follow the directions below. Thee first link is an image of the plugin menu that has the “Activate” link. Once it is installed, and activated you should see a password field on the comment form.
http://codex.wordpress.org/images/3/3a/plugins.png
http://codex.wordpress.org/Managing_Plugins (12:28 pm on April 25, 2012)
Dear Todd,
The plugin is promising and I installed in my http://ngurl.me/fgy blog. However, its third day after it is installed, I see spam comments entering into blog. I guess I’ve installed the plugin correctly; the password field appears on my comment form; but why is it not stopping the spam comments? Did I do any mistake in configuring?
The plugin only blocks comment spam, not pingback or trackback spam. Read the section on this page about Pingbacks and Trackbacks, then download and install that plugin using the link in that same section of the page. The link is labeled Auto Close Pings and Trackbacks Plugin Download.
The number of comment spam blocked can be viewed on the plugin settings page. (1:27 am on April 25, 2012)
Hi Man
Installed your plugin and re-coded the side, but now my “Leave a Reply” message is showing twice before the comment box, is there any fix for this?
Matt
The comment_form function generates Leave a Reply at the top of the form, which means you have another Leave a Reply in the comments.php file itself, so removing that second one from comments.php will solve the problem. If you can’t solve the problem past the comments.php file code to http://pastebin.com/, provide me a link to the code, and I’ll reply with the modified code. (10:48 am on April 21, 2012)
True, but you could read the DOM, look for the input field after the e-mail address, and then extract the value. Not too hard to do with a good DOM parser … perhaps even with XPath. If the spammer is actually rendering the page using the FF engine or something and can execute scripts against it, then it could theoretically use jQuery or native DOM methods to retrieve the value.
Here’s the jQuery selector for that:
jQuery(“#email”).parent().next().next().children(“input”).val()
Open firebug, run that selector, and boom … you’ve got the value.
Have you tried using the plugin? (9:57 pm on April 20, 2012)
Hi Todd,
I installed your plugin and I am still getting spam through my contact form 7.
This form has only 3 fields (and 2 are required)
They are mostly random text that looks like this:
QsGGwH blkjhskgrejc, [url=http://oigxkvvsaleq.com/]oigxkvvsaleq[/url], [link=http://zqudsflhvrcz.com/]zqudsflhvrcz[/link], http://gpiwutmfcoaa.com/
what’s wrong?
also, where can I link to a remote text file of blocked ip address?
Thank you.
Cathy
Spam Free WordPress is designed to block comment spam only, not trackback spam, or contact form spam.
Unless you’re running a network of blogs then there is no need for the remote blocklist. Instead use the local blocklist if manual comment spam is submitted. (9:52 pm on April 20, 2012)
Just to let you know, i have been using the Spam Free WordPress on WordPress 3.4-beta2. and it has worked wonderful. I have had no spam the past few nights. The other morning I woke up and had 25 spam in my spam folder. Since i downloaded i have had none. I only activate at night when the most spamming takes place!
Thanks great plugin
You are correct that there is no tag. However I could throw all the value tags what they are set to into an array in php. Then look for the word “Copy This Password” which then I immediately find the index of the array I am on and pull that value. The reason is because the last value tag is the one that has the password that has to be forced back into the field. Would this work? I did put this on our blog to test how well it does against the recent spam we have seen an increase and I applaud your work. I am just trying to get my head around it how it is working with my limited programming knowledge on arrays and what someone can extract from HTML source documents.
Right now the plugin works by using anonymous password authentication. There is another version coming soon, as time allows, that may change the way the plugin operates. (5:24 pm on April 19, 2012)
Todd, – I may be missing something here. But couldn’t someone make a script to read my site and many others, view that source from each of its pages, and pull the password and submit a comment with the password that is visible in the source of the html? I am not an expert programmer by any means but if I want to extract data from a site like I have in the past I take the source, rip the tags out, feed it into a database and done. Could you comment on this either here or send me an email why your system will block this and please keep in mind I am not an expert programmer.
There is no identifying tag that can be used to extract the password from the form. (10:35 am on April 19, 2012)
“The code you pasted shows functions, which doesn’t help. I would need to see the code for each of the three functions to know if there is a hook that can be used to display the password field. (2:32 pm on April 16, 2012)”
Todd,
Thanks for the reply.
Reviewing other posts I anticipated a need for the text of the “comments.php” file. That is the complete code there in the theme on the initial site I wanted to use your solution.
I batted 0/2 today on this project. Swapping out the comments.php code in one of my Catalyst sites (1.5), didn’t get the password box either.
Again, thanks.
Wud
…I never really check up on plugins or anything, but lately I’ve been getting HAMMERED with spambots, to the tune of anywhere between 10-100 a day (on a lower to medium trafficked site) and I just wanted to say CHEERS and THANK YOU whole heartedly!
Clean install, and it looks like it’s really done the trick! Bravo!
http://pastebin.com/jxzs9EWN
PASTEBINNED
The code you pasted shows functions, which doesn’t help. I would need to see the code for each of the three functions to know if there is a hook that can be used to display the password field. (2:32 pm on April 16, 2012)
I am using a mobile responsive theme that has this code in the comments.php file. I have commented out the “comment” section.
Please advise as there is no ” tags. I am using WP3.3.1, fresh launch and do not have the appropriate password box with your plug in installed.
Thank you
Hello, thank you for the nice plugin. However, I do not find any information on internationalization, and after doing a code check I decided it is not internationalisable. Do you intend to add possibility for internationalization in the future? I could just translate the two publically visible strings, but I need to use it in a multilanguage multisite installation, which rules out simple translation.
Yes there are plans to make the plugin multilingual. This feature may be added on the next release. (7:21 pm)
I added your add’l code to another site I created and that made the comments work just fine. I bookmarked your support page and here I am again.
For my newest site, I cannot find any of the code you reference in the comment.php. (I’m not a coder, but I can generally find stuff like .) The template I’m using is Desk 1.5.3 by Nearfrog Designs.
Any guidance would be appreciated.
Post all of the code from your original comments.php file to http://pastebin.com/, provide a link to that code, and I will then reply with a link to pastebin with the new code for your comments.php file if any changes are required. (7:19 pm)
Thanks for your advice. I’ve disabled pingbacks/trackbacks and disabled Akismet. I will see how things go now.
I do see the password field on pages/posts and people are able to leave legitimate comments.
I have installed Spam Free WordPress but am still getting some spam comments. So I am adding the IP address reported by WordPress to the local IP blocklist (have set that to “On”), but I’m still getting spam comments from those IP addresses.
I am on WP v3.3.1 but the password fields did not automatically appear on my comment form so I used the WordPress 2.8/2.9 method shown here to enable them.
I also still have Akismet enabled.
Wondering what step I might have missed or mistake made?
If Spam is still getting through after blocking the IP address, then it is not comment spam it is trackback spam, which Spam Free WordPress does not block. Read the Pingbacks and Trackbacks section on this page, then download and install that plugin to close Pingbacks and Trackbacks.
After that disable Akismet.
Post all the code from your comments.php file at http://pastebin.com/, then post a link to that pastebin code here. I will reply with a pastbin link that will contain the modified code you can use to replace your existing comments.php code.
If you don’t see the password field on your comment form, then no one will be able to leave a comment even though spam will still be blocked.
FYI: I won’t be able to respond until sometime Wednesday or Thursday due to an extended obligation.
So does this mean it does not use cookies? No cookies at all?
Thanks.
This plugin does not use cookies.
Update: Seems this is not really working for me. Found a spam message waiting to be moderated this morning. And ping and trackback plugin has been activated and the setting for allowing them has been turned off in the dashboard.