Skip to content

Instantly share code, notes, and snippets.

@luclemo
Forked from norcross/emailbot_ssc.php
Last active October 22, 2018 19:13
Show Gist options
  • Save luclemo/66dacc23695b5866060b49c617360d7b to your computer and use it in GitHub Desktop.
Save luclemo/66dacc23695b5866060b49c617360d7b to your computer and use it in GitHub Desktop.
Obfuscate email shortcode #wordpress
/*
Usage (on the HTML tab, not the visual editor)
[email address="[email protected]"]
*/
function emailbot_ssc($attr) {
extract( shortcode_atts( array(
'address' => '',
), $attr ) );
$email = '<a class="email_link" href="mailto:'.antispambot($attr['address']).'" title="Send Us An Email" target="_blank">';
$email .= antispambot($attr['address']);
$email .= '</a>';
return $email;
}
add_shortcode('email', 'emailbot_ssc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment