• Resolved Riversatile

    (@riversatile)


    Hi,
    I still don’t understand why my jQuery script is still loaded in my header section !

    function update_jquery() {
    	if (!is_admin()) {
    		wp_deregister_script('jquery');
    		wp_register_script('jquery','/scripts/jquery-2.1.1.min.js','',null,true);
    		wp_enqueue_script('jquery');
    	}
    }
    add_action('wp_enqueue_scripts', 'update_jquery');

    This is what I checked :

    • – The function above is correct (I verified that the code was correct using the WordPress Codex).
    • – I tested to remove the above function that deregister jQuery to load the WordPress default jQuery library (in case my function was incorrect).
    • wp_footer() is well present in the loaded file footer.php from my theme files.
    • – I tested all the following workarounds to call jQuery in the footer :
    1. How to enqueue the bundled jQuery in footer – The Right Way
    2. Getting all JavaScript into the Footer in WordPress ?

    Thanks for your support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Riversatile

    (@riversatile)

    Well… By disabling all my plugins, I got jQuery script in the Footer section !
    This means I probably have an extension which forces loading jQuery in the header section.

    Thread Starter Riversatile

    (@riversatile)

    This behavior was caused by Collapse-O-Matic plugin.

    I don’t know why, but save options in the “Collapse-O-Matic” settings has solved the issue !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fails to load jQuery script in the Footer’ is closed to new replies.