Email Obfuscation Shortcode

There are a number of reasons why you might want to display an email address in a post: providing your own contact information, providing a support contact for a company or product you’re writing about, and so on.

However, simply including an email address in your post is simply asking for an email harvester to nab it, adding it to a spammer’s database.

WordPress has a function for obfuscating email addresses, making it all the more difficult for the spammer’s to nab them with a harvester.

To add a shortcode to your Thesis-powered WordPress install, simply drop the following into your custom_functions.php file:

# Email obfuscation shortcode
function custom_email_shortcode( $atts , $content = null ) {
	return antispambot( $content );
}
add_shortcode( 'email', 'custom_email_shortcode' );

This is about as simple as it gets. Usage:

2 thoughts on “Email Obfuscation Shortcode”

  1. The only thing scary about actually using an email address is that the spambots get THAT much smarter each day. It just takes one…. :)

    This is nifty nevertheless. Also, love the Thesis specific bits of code!

  2. Ideally, i recommend using reCAPTCHA’s MailHide service to obfuscate email addresses; however, i’m not quite sure how to easily turn it into a WordPress shortcode. When i do, i’ll be posting it.

    You’re right, though; the email harvesters are getting better all the time, which is why i encourage everyone to participate in Project Honey Pot.

Leave a Comment

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

the Rick Beckman archive
Scroll to Top