21/10/20172

#

Liked: IndieWeb: The Book...

”For the month of November... I’m going to endeavor to lovingly craft together a string of about 2,000 words a day on the topic of the IndieWeb to create a book geared toward helping non-developers... more easily own their online identities and content.” - Chris Aldrich.

Chris often writes intros to and explanations of the #indieweb so I have no doubt he can pull this off.

Status

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