Last active
August 29, 2015 14:03
-
-
Save derekshirk/cb420413281e272f7b74 to your computer and use it in GitHub Desktop.
WordPress - email cloaking function
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 | |
$my_email_address = "[email protected]"; | |
$my_email_address_cloaked = antispambot( $my_email_address ); | |
echo $my_email_address_cloaked; | |
?> | |
// you can cloak email addresses anywhere in your posts wit this shortcode | |
<?php | |
function antispambot_sc( $atts ) { | |
extract( shortcode_atts( array( | |
'email' => '' | |
), $atts ) ); | |
return antispambot( $email ); | |
} | |
add_shortcode( 'antispambot', 'antispambot_sc' ); | |
// Usage: [antispambot email="[email protected]"] | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment