Whilst double-checking settings I was greeted by the notification “Your API key is no longer valid” for Akismet. I didn’t know they expired, maybe something changed with the last JetPack update.

This would explain why I’ve suddenly been getting more spam comments which Akismet really should be blocking. I know they try to “encourage” people to pay on the Basic (read “old free”) tier now - when going to get a new API key the cost slider was set at $27 by default.


More on comment spam

I’ve been getting more comment spam that’s not automatically nixed by Akismet. Under Settings > Discussion you can add terms to a blacklist so that comments are automatically placed in the bin but I wanted to go one step further.

I found a code snippet described as automatically deleting spam comments but it actually prevents them from being submitted in the first place using wp_die to kill the process on detection of specified terms.

It didn’t seem to work properly throwing “empty needle” errors when the found term was not the first in the list. Not only that but to edit the list of prohibited terms you would have to edit the code itself.

So I reworked it, fixed the empty needle errors by changing the detection method and created a simple plugin which lets you specify banned terms via a settings page in wp-admin.

When a banned term is found the comment is prevented from being submitted and wp_die kicks in displaying a reason and the prohibited term:

I’ll see how it goes and will be adding more items as I come across them, but let me know if you have any problems submitting comments and what term is specified.

You can check out the plugin on GitHub.

More on comment spam