• Resolved Konstantinos Pappas

    (@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 4 years, 8 months ago by Konstantinos Pappas. Reason: Added line number
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_enqueue_script called incorrectly’ is closed to new replies.