WordPress.org

Support

Support » Themes and Templates » I keep getting all kinds of error messages

I keep getting all kinds of error messages

  • I get all kinds of error messages. I thought I’d start trouble shooting with this one.

    Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /hsphere/local/home/westpark/westparkucc.org/wordpress/wp-includes/functions.php on line 2758

    What should I be doing to get rid of this? I know I have wp_debug=true. If it’s just a matter of production rollover which will set wp_debug=false then I won’t worry about it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    @jcastaneda

    THEME COFFEE MONKEY

    How are you enqueuing your scripts?

    At the moment , I don’t know. I’m looking through the PHP code to figure it out.

    // Main Stylesheet
    wp_enqueue_style( ‘risen-style’, get_stylesheet_uri(), false, RISEN_VERSION ); // bust cache on theme update

    // Light or Dark Style
    risen_enqueue_base_style( ‘risen-base-style’ );

    I believe this is the code in question.

    Moderator Jose Castaneda

    @jcastaneda

    THEME COFFEE MONKEY

    Are you hooking it to wp_enqueue_scripts()?

    function load_theme_styles(){
      wp_enqueue_style( 'risen-style', get_stylesheet_uri() );
    }
    
    add_action( 'wp_enqueue_scripts', 'load_theme_styles');

    It should work. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I keep getting all kinds of error messages’ is closed to new replies.
Skip to toolbar