WP plugin: Email Immunizer
Inspired by a support forum thread, I wrote Email Immunizer, a little WordPress plugin which provides protection against email harvesters by taking email addresses and mailto links on your blog and converting their text to numeric character references.
To install, here’s those very hard to follow instructions: download the zip file and extract email-immunizer.php from it, upload this to your wp-content/plugins directory, then activate Email Immunizer under Plugins in WordPress.
From then on just write your email addresses as normal. The plugin works straight off seeking out and displaying any and all addresses it finds throughout your blog, morphing them into HTML-ized equivalents by making use of the internal WordPress function antispambot() for the alphanumeric to character reference conversion. There’s lots of things hiding in this blogging tool.
(Plugin note: Another of those “didn’t know about that one” episodes of mine. Scott Reilly (Coffee2Code) released a very similar plugin some months back: Obfuscate Email. Thanks to Bryan for helping confirm I’m an unoriginal hack. Hey, at least now you have options!)
Email Immunizer currently filters on the following blog components (associated template tags in brackets):
- author email (the_author_email())
- post/Page content (the_content())
- excerpt (the_excerpt())
- comment author email (comment_author_email())
- comment text (comment_text())
- comment excerpt (comment_excerpt())
- RSS-formatted content, excerpt & comment text (the_content_rss(), the_excerpt_rss(), comment_text_rss())
If you’ve applied more manual methods for converting email addresses on your blog previously, Email Immunizer will in most cases leave them be. So you shouldn’t need to edit old posts and whatnot, reconverting obfuscated addresses to standard ones. Thought it important to note that.