• Please I am still unable to solve this error.
    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 login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/…../public_html/wp-includes/functions.php on line 4778 Notice: Constant DB_COLLATE already defined in /home/…../public_html/wp-config.php on line 83

    Below is my child theme function as nothing extra is added since i got the child theme

    
    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
    

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    That function looks good to me.

    Do you have any other functions elsewhere? Maybe a plugin you’re using is causing the issue?

    Thread Starter ysgmesh

    (@ysgmesh)

    Thanks for your reply. I tried it by disabling all plugins but the issue persisted. Please can you check this on your end?

    Theme Author Tom

    (@edge22)

    That function itself is correct. You can see that wp_enqueue_style is being called inside that function, and the function is being hooked into the wp_enqueue_scripts hook, which is what the notice is suggesting.

    Does the issue go away if you remove that function?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_enqueue_style was called incorrectly’ is closed to new replies.