Skip to content

Instantly share code, notes, and snippets.

@iamcanadian1973
Created June 27, 2014 23:03
Show Gist options
  • Save iamcanadian1973/69ffd4f9928cb4b0774d to your computer and use it in GitHub Desktop.
Save iamcanadian1973/69ffd4f9928cb4b0774d to your computer and use it in GitHub Desktop.
Generate a safe HTML anchor
/**
* Generates a safe email HTML anchor
*
*
* @access public
* @param string
* @return string
*/
function safe_email($email = '' ){
if( !$email ) {
$email = get_option('admin_email');
}
if ( ! is_email( $email ) )
return;
return '<a href="mailto:'.antispambot($email).'">'.antispambot($email).'</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment