Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Email cloaking shortcode

Email cloaking shortcode using the WordPress antispambot() function.

// Add Shortcode
function email_cloaking_shortcode( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'email' => '',
		),
		$atts,
		'cloak'
	);

	// Return cloaked email
	return antispambot( $atts['email'] );

}
add_shortcode( 'cloak', 'email_cloaking_shortcode' );