Last active
October 13, 2015 17:27
-
-
Save robertdall/4230428 to your computer and use it in GitHub Desktop.
Email Short Code
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
// Hide Email from Spam Bots using antispam bot http://codex.wordpress.org/Function_Reference/antispambot | |
function HideMail($atts , $content = null ){ | |
if ( ! is_email ($content) ) | |
return; | |
return '<a href="mailto:'.antispambot($content).'">'.antispambot($content).'</a>'; | |
} | |
add_shortcode( 'email','HideMail'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have forked your shortcode here: https://gist.github.com/4235056 and made some important improvements to it:
$content
is an email address, and if not, just return out of the function, avoiding potential issues if it wasn't an email address