I ran into a case where the wp_set_consent() function was called by cookiebot-wp-consent-level-api-integration.js before /plugins/wp-consent-api/assets/js/wp-consent-api.min.js had loaded, resulting in a JavaScript console error of "Uncaught ReferenceError: wp_set_content is not defined".
Looking at the Consent_API_Helper class, it seems to me that the call to register_script here should declare array( 'wp-consent-api' ) as a dependency instead of passing null as the 3rd param.
|
wp_register_script( |
|
'cookiebot-wp-consent-level-api-integration', |
|
$is_cb_frame ? asset_url( self::CB_FRAME_SCRIPT_PATH ) : asset_url( self::UC_FRAME_SCRIPT_PATH ), |
|
null, |
|
Cookiebot_WP::COOKIEBOT_PLUGIN_VERSION, |
|
false |
|
); |
|
wp_enqueue_script( 'cookiebot-wp-consent-level-api-integration' ); |
I ran into a case where the wp_set_consent() function was called by cookiebot-wp-consent-level-api-integration.js before /plugins/wp-consent-api/assets/js/wp-consent-api.min.js had loaded, resulting in a JavaScript console error of "Uncaught ReferenceError: wp_set_content is not defined".
Looking at the Consent_API_Helper class, it seems to me that the call to register_script here should declare
array( 'wp-consent-api' )as a dependency instead of passingnullas the 3rd param.CookiebotWP/src/lib/Consent_API_Helper.php
Lines 51 to 58 in 84dedab