WordPress.org

Ready to get started?Download WordPress

Forums

I keep getting all kinds of error messages (5 posts)

  1. divvajacko
    Member
    Posted 1 year ago #

    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.

  2. Jose Castaneda
    Member
    Posted 1 year ago #

    How are you enqueuing your scripts?

  3. divvajacko
    Member
    Posted 1 year ago #

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

  4. divvajacko
    Member
    Posted 1 year ago #

    // 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.

  5. Jose Castaneda
    Member
    Posted 1 year ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Topic