Support » Plugin: Responsive Cookie Banner » Quick fix on wp_register_script

  • Resolved Lucy Tomas

    (@lucymtc)


    Hi,
    Just a quick fix for this php alert.

    Notice: wp_register_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.

    Use:

    // Register the Javascript & CSS
    add_action( 'wp_enqueue_scripts', 'cookieBannerJs_load_scripts');
    
    function cookieBannerJs_load_scripts(){
         wp_register_script( 'cookieBannerJs', plugins_url() . '/responsive-cookie-banner/js.js');
         wp_register_style( 'cookieBannerCss', plugins_url( '/responsive-cookie-banner/style.css' ) );
    }

    https://wordpress.org/plugins/responsive-cookie-banner/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Quick fix on wp_register_script’ is closed to new replies.