If you are on WordPress, you can consider using the built-in antispambot() function to encode your email address. The function will encode the characters in your address to their HTML character entity (the letter a becomes a and the @ symbol becomes @) though they will render correctly in the browser.
<?php echo antispambot("email@example.com"); ?>
This will result in the email address being displayed on your website
in a readable format.
However, the bots that are trying to harvest email from your HTML source will see html codes that do not display as a readable email address.
How to Accomplish This
Here is one way to accomplish the above.
- Install the WordPress plugin "Shortcode EXEC PHP". This will allow you to create your own custom shortcodes that contain PHP code.
- After installing Shortcode EXEC PHP, create your 5 PHP code snippet by navigating to tools >> Shortcode EXEC PHP in WordPress
- Enter the PHP code to use the built-in antispambot function
Note: When using Shortcode EXEC PHP, you do not need to include the <?php beggining and ?> end tags.
- Name your new shortcode
- You can now edit the page where you would like the email address to appear --simply adding the shortcode [myemailaddress] to the page.