DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

As most of you know, spam bots are constantly scanning the internet in order to find emails to spam. Of course, you don’t want to receive spam, but what if you need to display your email (or someone else) on your blog? Here is a quick tip to obfuscate email adresses on your blog.

This tip is pretty easy to use. Just use the antispambot() function anywhere in your theme templates:

<?php antispambot('name@email.com',1 ) ?>

But what if you need to type email adresses in WP editor? No problem, I have a shortcode for that! Just have a look on CatsWhoCode.com.

Credits: WordPress Codex



  1. Thanks!
    pretty useful

  2. The code, as written, is meant to be used within a mailto link, “mailto:that code.”

    Changing the “1” to a “0” (or leaving the “,1” out altogether) encodes the mail link for use in plaintext, outside of a mailto link (or as its link text).

  3. An echo would be useful in there 🙂
    The function does not echo any result by its own.

Leave a Comment

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