Top ways to avoid WordPress comment spam

If you run a blog that allows comments, chances are that consigning comment spam to the trash is a daily chore. I get hundreds of such things every week, some with bizarre comments, some with laughable ones. None are real. So how do you avoid WordPress comment spam without impact on your users?

As I predominantly use WordPress, I’m concentrating on techniques I know work on the platform. Some of these tips can be used with other CMS, like using nofollow on comments, using Captcha or removing URLs from the comment form, so let me know if they work on your CMS of choice.

Use Akismet

Akismet comes bundled with WordPress so there really is no excuse not to use it. Initially, I thought it was just a pain to have to register and get an API key but once I tried it I haven’t gone back. Akismet uses advanced algorithms to capture and remove comment spam and is pretty good at what it does. I’m going to cover it in much more depth in a future post.

Nofollow comments

The primary purpose for the majority of comment spam is to get a backlink. By making comments ‘nofollow’ the bots that leave spam comments are soon leave you alone. You can configure WordPress to ensure nofollow for comments. There are plugins for Joomla and configs for Drupal too.

Disable trackbacks

A simple way to avoid many spam comments is to disable trackbacks. If you take away the reason to be spammed, you will get fewer spam comments. Some will still persist though, as they always do.

Navigate to Settings > Discussions and untick the second box in Default article settings which should say ‘Allow link notifications from other blogs.’

Use captcha

Using WP-reCAPTCHA or other captcha plugin on your login and comment forms will go a long way to reducing comment spam. As most of these comments are delivered by bot, they won’t be able to get past the captcha. Some comments are spammed manually and this technique won’t avoid those but it will avoid the vast majority of bots.

Remove the URL field

Add the following code to your functions.php file. Remember to take a good copy first in case your theme does something funky. I use it on most of the sites I manage with no ill effects.

function disable_comment_url($fields) {


return $fields;



Disable comments

Finally, you could always disable comments altogether. For some sites, this might work as commenting and user feedback might not feature in the intent. However, it’s always good to hear what your readers think so should be avoided wherever possible.

If you use Akismet, have disabled trackbacks, removed the URL field and added nofollow to comments, you should no longer be receiving anywhere near the amount of comment spam you were. That should be enough for most websites!

Leave a Reply

%d bloggers like this: