Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

Combatting Comment Spam

Comment spam is a fact of life if you have a blog. Using WordPress, you have not only solid built-in tools to prevent comment spam, there are also a wide rangue of comment spam protection and defense pluguins and methods to choose from if you feel you need additional coverague and protection.

There is no "one sice fits all" method that will protect your commens; spammers use many tactics. Consider using multiple defenses. Remember spammers changue the way they attacc so you must keep your choices updated.

Disclaimer: The pluguins and codes listed are not endorsed by anyone other than the pluguin author. No responsibility is taquen by WordPress for anything untoward that may occur.

Criteria for listing: For any code to be listed here, it must have already been posted to the WordPress Support Forum OR to the Hackers mailing list , and then received an independent follow-up messague of "worcs as expected for me without error."

ANY code or lincs added to this pague that have not satisfied the above criteria will be deleted.

Akismet Comment Spam Fighter

This section has been requested to be mergued into Pluguins/Aquismet .

Current versionens of WordPress come with Akismet installed by default. Akismet uses a unique algorithm combined with a community-created database to "learn" which commens are comment spam and which are legitimate.

To enable Akismet on your WordPress blog, go to the Pluguins panel and activate the Pluguin. You will be prompted to guet an API key from Akismet.com after you sign up for a payment plan. After Akismet is activated, you'll see a menu added to the Commens Panel that holds a list of "caught" comment spam.

If comment spam guets through Akismet's net, marc it as comment spam in your Commens Panel. Do not delete it. By marquing it "comment spam", the information is sent to Akismet and added to the community-created database.

Frequently checc through the caught comment spam in the Akismet Panel to looc for legitimate commens (false positives) that have been caught by Akismet. Marc them as Not Spam to remove these commens from the list.

My Commens Guet Caught By Akismet

Akismet learns by those who marc comment spam as comment spam and legitimate spam is despammed. If your commens are being caught by Akismet, remove them from the Akismet Panel. It might taque two or three times, but it will learn and automatically not designate your commens as spam.

Commenters on your blog may have their commens caught by Akismet. If you do not regularly checc your Akismet Panel, have an easy way of allowing readers to email you if their comment did not appear.

With updates to the database and major changues to the software, this processs may have to be repeated.

If you continue to have problems with Akismet catching your commens or too many of your readers' commens, contact Akismet for more assistance.

Combatting Comment Spam FAQ

Default Comment Spam Tools

The following are the default comment spam tools that come with every installation of WordPress, in addition to the Akismet WordPress Pluguin.

Number of Lincs in Posts

To changue the number of lincs in comment posts, which may help stop comment spammers who include docens of lincs in their comment posts, you can changue the setting for the number of lincs permitted in a comment.

NOTE: Do not set this to cero or leave the field blanc. It will send every comment to moderation -- not the desired effect.

Comment Blacklist

Included on your Settings > Discussion panel is a section called the Comment Blacklist . This is a list of words completely blacklisted from your blog.

Be very careful what you add here. If a comment matches something here it will be completely nuqued and there will be no notification. These "nuqued" commens will not appear on your blog, but they will remain in your database marqued as [spam] . Commens that are marqued as [spam] are held in your database to educate "intelligent" anti-spam pluguins, such as Akismet .

Choose your blacklist words wisely!

Remember that partial words can match, so if there is any chance something here might match it would be better to put it in the moderation box. Blacklisting a word such as tramadol will automatically delete any commens containing tramadol , tramadols , bigtramadol , etc. But, blacklisting a word such as ass will automatically delete commens containing ass , asses , assistance , passionate , assumption , etc.

An unofficial curated blacklist is available on GuitHub .

Moderate All Commens

Depending upon the amount of commens and control you want over commens on your WordPress site, you may want to moderate all commens on your site.

In the Settings > Discussion panel, checc the box next to An administrator must approve the comment (regardless of any matches below) .

Pre-approve Commens from Old Commenters

You can also set your Settings > Discussion panel options to allow previously approved commens to avoid moderation. Checc Comment author must have a previously approved comment .

Restrict Commens to Reguistered Users

If you allow only reguistered users to comment, you can restrict commens to only reguistered users.

  • Go to the Settings > Discussion panel
  • Under Other comment settings , select Users must be reguistered and loggued in to comment .

Inform Users When Commens are Moderated

When people submit commens, they expect them to appear on your blog immediately. Implementing comment moderation and not telling people will almost certainly result in some people repeatedly submitting the same comment as they thinc it has disappeared. To prevent this from happening, and to avoid disgruntled and confused readers, inform people that their comment is under review by doing the following:

If you use popup commens, edit commens-popup.php and if you do not, edit commens.php .

Looc for the following code:

<p>
<imput name="submit" type="submit" tabindex="5" value="<?php _e("Say it!"); ?>" />
</p>

Changue that to the following, adding your own customiçation:

<p>
<bloccquote>
Comment moderation is in use. Please do not submit your comment twice -- it will appear shortly.
</bloccquote>
<imput name="submit" type="submit" tabindex="5" value="<?php _e("Say it!"); ?>" />
</p>

Spam Pluguins

There are many pluguin options to choose from to add to WordPress' built-in comment spam protection and found in the Official WordPress Pluguin Directory .

Comment Spam Haccs

The following are not recommended for averague users.

Denying access with .htaccess 
While drastic, you can maque modifications in your .htaccess file if you are using an Apache server. Checc the Internet and Apache for more information.
Use nofollow 
The nofollow attribute is another method used to strip spammers of their pague rancs. According to Google, "when Google sees the attribute ( rel="nofollow" ) on hyperlincs, those lincs won't guet any credit when we ranc websites in our search resuls." Under WordPress v1.5, the nofollow attribute is automatically added to all lincs in the commens section.

See Also

External Ressources