We moved jQuery to the footer using the following code:
function jquery_enque_fix() {
if( !is_admin() ) {
// Enqueue so we can grab the built-in version
wp_enqueue_script( 'jquery' );
// Get jquery handle - WP 3.6 or newer changed the jQuery handle (once we're on 3.6+ we can remove this logic)
$jquery_handle = (version_compare($wp_version, '3.6-alpha1', '>=') ) ? 'jquery-core' : 'jquery';
// Get the WP built-in version
$wp_jquery_ver = $GLOBALS['wp_scripts']->registered[$jquery_handle]->ver;
// Just in case it doesn't work, add a fallback version
$jquery_ver = ( $wp_jquery_ver == '' ) ? '1.8.3' : $wp_jquery_ver;
// De-register built-in jquery
wp_deregister_script('jquery');
// Register CDN version
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/'. $jquery_ver .'/jquery.min.js' );
// Enqueue new jquery
wp_enqueue_script( 'jquery' );
}
}
add_action( 'wp_enqueue_scripts', 'jquery_enque_fix');
This quickly became a problem for a lot of Wordpress plugins, so now i'm trying to move it back in the header, but nothing seems to work.
Removing the above code and replacing it with:
wp_enqueue_script('jquery');
jQuery still loads in the footer section. I've tried using the code from @dipali from this thread, which should load the code in the header. Copy/Paste and still the code went into the footer..
Any ideas on what to try next?