Prevent Email Spam with WordPress AntiSpamBot Function

125

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