WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm getting a lot of spam on my Wordpress blog. I'd like to cut down on the amount of comments I have to moderate. I'm looking for a plugin that does something like this: automatically marks comments as spam, and allows me to say "yes, this is spam". Once I've marked the comment as spam, block the user's IP address for X number of days. Is there a plugin out there that will do that, rather than me going through and blocking IP addresses manually?

share|improve this question

closed as off-topic by Pieter Goosen, Johannes Pille, gmazzap, cybmeta, kaiser Nov 22 '14 at 8:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Do you have access to your webserver? I use a program called "fail2ban". This program scans log files to see if certain things have been logged - such as people trying to access your email - and bans the IP address for a set amount of time. You can vary it from 1 second to a thousand years :-)

Now, I wrote a bit of code that creates a log of every time WordPress marks something as spam, and I wrote a filter for fail2ban to read those log files.

Akismet is brilliant at marking things as spam, but you can still end up with tons of spam to check in case it's wrongly marked. You would need to use Akismet with this method - that takes care of finding and marking spam.

If you want me to give further details, let me know and I'll try and walk you through the process. I can give you code for fail2ban which only monitors spam so it's simpler (fail2ban is a great piece of freeware which can monitor every part of your server).

I run a very busy blog which used to get 70-100 spam mails a day, and since I brought in the ban system - which bans IP addresses for a week (just in case it was a spoofed IP address) - my spam has gone down to about 5-6 a day. It's definitely been worth doing for me.

share|improve this answer
Did you get a chance to consider this idea? Last night I was the victim of a massive spam attack - except, it ended with only 12 spams, because after 3 entries in the log, the IP is blocked for 1 month. So, 4 IP addresses tried to connect and spam a few hundred times, but only got as far as leaving 3 each :) – tony collins Jun 21 '12 at 20:51
I've started using the same technique using the WordPress plugin here to create the spam logs: blog.shadypixel.com/spam-log-plugin – markshep Sep 12 '14 at 5:15

I use WordPress IP Blocker Pro which accomplishes all my worries. It has features like Auto-IP Blocking and Country Blocking as well.

share|improve this answer

The plugin WP-Ban has a variety of options for blocking IP addresses, BUT unfortunately I couldn't find anything that auto blocks an IP based on their comment being marked as spam.

Spam Free Wordpress claims to block all automated spam automatically. I have never used it, so I can't vouch for it. It has good ratings (insert grain of salt here) on Wordpress.org so maybe give it a try.

Also, consider looking at your web hosts options. An 'IP Deny Manager' can be found in cpanel etc, but this also won't block automatically based off comments.

As for blocking IP addresses for a limited amount of time, I couldn't find any plugins in my search that had that functionality.

share|improve this answer

Have you tried akismet? I've found it to be very good at filtering out spam. You have to grab an API key, which you can get here. They are free for personal use.

Akismet lets you see how many approved comments users have, and other such niceties. I'm not sure if you can block IP addresses for a limited amount of time. My hunch is that you can't. My question would be: why do you want to block for just a limited amount of time?

If you're just looking for an awesome spam filter, I'd roll with akismet and call it a day.

share|improve this answer
I'd like to be able to ban users for a limited time, (like a year), and then pull the IP addresses from the ban. – daviesgeek Jun 15 '12 at 6:31

This is a problem we have as well! We have found The Bad behavior plug-in works rather. well.

share|improve this answer
up vote 0 down vote accepted

Here's what I ended up doing. Since I received thousands of spam comments a week, I began to mark the spam comments as spam. Then, I installed WP-Ban, a simple little plugin that allows you to block IP addresses. Then, I used a simple MYSQL code block to show me all the duplicate IP addresses that were marked as spam:

SELECT `comment_author_IP`
FROM `wp_comments`
WHERE `comment_approved` = 'spam'
GROUP by `comment_author_IP`
HAVING count(*)>1

This has worked really well for me and has drastically cut down on the amount of spam I receive.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.