Home Forums Event Espresso Premium Link from custom shortcode in email template not displaying as expected

Link from custom shortcode in email template not displaying as expected

Posted: September 10, 2021 at 3:30 am


September 10, 2021 at 3:30 am


I’m having a little difficult getting links from custom shortcodes to display in the same way as links created by default shortcodes. I am using the default template and the links that are created via the standard shortcodes are working fine – they display as links with the correct formatting. However the Zoom link that I am inserting (see code below) sometimes displays as a hyperlink and sometimes (I am testing each time with a fully URL) not and never with the styling applied. Is there something obvious that needs to happen? Many thanks in advance for any help

function register_new_tony_shortcodes( $shortcodes, EE_Shortcodes $lib ) {
	//Add a shortcode to be used with the EE Datetimes within messages
	if ( $lib instanceof EE_Datetime_Shortcodes ) {
		$shortcodes['[ZOOM_LINK]'] = _('Zoom Link Shortcode');
	return $shortcodes;
add_filter( 'FHEE__EE_Shortcodes__shortcodes', 'register_new_tony_shortcodes', 10, 2 );
function register_new_tony_shortcodes_parser( $parsed, $shortcode, $data, $extra_data, EE_Shortcodes $lib ) {
	//Check for the datetime shortcodes and that the $data is the expected object (in this case an EE_Datetime)
	if ( $lib instanceof EE_Datetime_Shortcodes  && $data instanceof EE_Datetime ) {

		if ( $shortcode == '[ZOOM_LINK]' ) {
			$event = $data->event();
	        if ( $event instanceof EE_Event ) {
	            $evt_id = $event->ID();
			if ( !empty( $evt_id ) ) {
				$event_external_booking_group = get_field( 'event_external_booking', $evt_id );
				if( $event_external_booking_group['zoom_link'] ){
					$zoom_link = '<a href="'.$event_external_booking_group['zoom_link'].'" />'.$event_external_booking_group['zoom_link'].'</a>';

					return $zoom_link ;

	//If conditions above not met return the currently parsed content.
	return $parsed;
add_filter( 'FHEE__EE_Shortcodes__parser_after', 'register_new_tony_shortcodes_parser', 10, 5 );


  • Support Staff

September 10, 2021 at 4:16 am

Hi there,

Something that stands out when viewing that code is the incorrect syntax for the a tag:

'<a href="'.$event_external_booking_group['zoom_link'].'" />'.$event_external_booking_group['zoom_link'].'</a>';

The /> for the opening tag is incorrect and basically ‘self closes’ the opening a tag. When I send an email using that syntax, this is how the email is parsed (by the mailserver/client):

<a href=""></a>

The browser does its best to put that together and output it as a link but the correct syntax to use is:

'<a href="'.$event_external_booking_group['zoom_link'].'">'.$event_external_booking_group['zoom_link'].'</a>';


September 10, 2021 at 4:34 am

Thanks Tony. You are quite right – that fixed it!


  • Support Staff

September 13, 2021 at 4:18 am

Awesome, I’m glad its working 🙂

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso