I’m using WooCommerce Follow Ups and have created a custom variable for it to use using the following code in functions.php

add_action( 'fue_before_variable_replacements', 'fue_register_web_variable_replacements', 10, 4);

function fue_register_web_variable_replacements( $var, $email_data, 
$fue_email, $queue_item ) { 
$variables = array(
    'webinar_url'   => ''
);

if ( isset( $email_data['test'] ) && $email_data['test'] ) {
    $variables['webinar_url'] = 'http://example.com';

    if ( !empty( $email_data['order_id'] ) ) {
        $webinar_url = get_post_meta( get_the_ID(), 'webinar_link', true );

        if ( !empty( $webinar_url ) ) {
            $variables['webinar_url'] = $webinar_url;
        }
    }
} else {
    if ( !empty( $queue_item->order_id ) ) {
        $webinar_url = get_post_meta( get_the_ID(), 'webinar_link', true );

        if ( !empty( $webinar_url ) ) {
            $variables['webinar_url'] = $webinar_url;
        }
    }
}


$var->register( $variables );
}

This allows me to use the short code {webinar_url} in the Follow Up Email creator. My issue is that when I add this to just output it’s value it displays http://example.com properly.

But if I use this as the value for the href for the a element (Join the Webinar) it outputs the value as http//example.com. It has removed the : from the output.

How can I prevent this from happening?

Thank you.

Read more here: Colon being sanitized from variable WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: