Passing Parametersfrom shorcode to enqueue script

I need to pass the parameters present in the second script to the first script in the wp_enqueue_script

/FIRST SCRIPT/
function add_script() {
wp_enqueue_script(‘kross-js’, ‘https://’EDITOR-ID’kross1.com/widget/6.js?lang=it&be_id=’USER-ID’, array(), ” , false);
}

add_action( ‘wp_enqueue_scripts’, ‘add_script’ );

/SECOND SCRIPT/

function kross_shortcode( $atts ) {

// Attributes
$atts = shortcode_atts(
array(
‘USER-ID’ => ”,
‘EDITOR-ID’ => ”,
),
$atts
);

return ‘ ‘;

}

add_shortcode( ‘kross’, ‘kross_shortcode’ );

Read more here:: Passing Parametersfrom shorcode to enqueue script

Leave a Reply

Your email address will not be published. Required fields are marked *