Skip to content

bug in Consent_API_Helper? #341

@Kevin-Hamilton

Description

@Kevin-Hamilton

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' );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions