Last active
August 29, 2015 14:14
-
-
Save tahirtaous/cf0eb4357e2007eae436 to your computer and use it in GitHub Desktop.
This is probably one of the most well-hidden functions in the WordPress codebase. This function aims to convert an email into HTML entities in order to mask email addresses from evil scrapers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference : https://www.cms2cms.com/blog/6-useful-yet-relatively-unknown-wordpress-functions/ | |
// add this code to sidebar.php or anywhere you want to display email addess | |
// remove <?php and ?> if you are going to paste this in functions.php | |
// Tested WordPress 4.1 Jan 25 2015 | |
<?php | |
$email = '[email protected]'; | |
echo 'You can contact me at ' . antispambot( $email ) . ' any time'; | |
?> | |
// above code will genereta following HTML | |
// You can contact me at [email protected] any time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment