Support » Plugin: Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control » wp_enqueue_script called incorrectly

  • Resolved over-engineer

    (@overengineer)


    Hello,

    I just wanted to let you know that the latest version (3.7.0) on a WordPress installation with WP_DEBUG enabled, outputs the following notice:

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks.

    The issue seems to be caused by this wp_enqueue_script():

    
    //Add Gutenberg Widget
    wp_enqueue_script( 
      'cookiebot-declaration', 
      plugin_dir_url( __FILE__ ) . '/js/block.js', 
      array('wp-blocks', 'wp-i18n', 'wp-element'), // Required scripts for the block
      $this->version
    );
    

    which is located in the gutenberg_block_setup() method of the Cookiebot_WP class in cookiebot.php (line 225)

    • This topic was modified 2 months, 2 weeks ago by over-engineer. Reason: Added line number
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.