Created
July 26, 2015 15:26
-
-
Save dboutote/4a76b3ad34b448d2afb6 to your computer and use it in GitHub Desktop.
Hide email from Spam Bots using a shortcode. (WordPress theme)
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
<?php | |
/** | |
* Hide email from Spam Bots using a shortcode. | |
* | |
* @param array $atts Shortcode attributes. Not used. | |
* @param string $content The shortcode content. Should be an email address. | |
* | |
* @return string The obfuscated email address. | |
*/ | |
function _ss_hide_email_shortcode( $atts , $content = null ) { | |
if ( ! is_email( $content ) ) { | |
return; | |
} | |
return antispambot( $content ); | |
} | |
add_shortcode( 'email', '_ss_hide_email_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment