Blog Image

WP function to make your email address safer (antispambot)

function wpcodex_hide_email_shortcode( $atts , $content = null ) {
	if ( ! is_email( $content ) ) {
		return;
	}
	return '<a href="mailto:' . antispambot( $content ) . '">'.antispambot( $content ).'</a>';
}

add_shortcode( 'email', 'wpcodex_hide_email_shortcode' );
← Go home