We recently wrote an article about about how to encrypt emails in WordPress with Cryptx. And as useful as this plugin is, there is actually another way to do this that doesn’t involve any plugin. One of our users pointed us to the WordPress Codex. Although most people don’t know, there is a function in WordPress called antispambot. This function essentially lets you hide your email address by converting every character to an HTML entity.
All you have to do is paste the code like this anywhere you want in your theme:
<?php antispambot('protectmy@email.com') ?>
Don’t forget to replace “protectmy@email.com” with your own email and no spam bot will be able to find it.
Source: WordPress Codex
@Ryan Lee Ball Could you please provide some further info? I would be interested in using this function in the way you have mentioned.
Thanks
@Ryan, could you provide somw further info please? Would be interested in using this code.
Thanks
With just a few lines of code in your functions.php file, you can add a content filter that makes use of WordPress’ inbuilt antispambot() function.
The function doesn’t take an array. So you would have to use it twice for a different email address rather than separating by comma
Great tip. If we want to protect more than one address, do we simply put a comma between the names?