In this file
wp-include/script-loader.php
Have this code:
$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.11.3');
$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.11.3');
$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.2.1');
How do I put the jquery in the footer?
I've tried adding a fifth parameter "true" or "1", but does not work.
...
* Localizes some of them.
* args order: $scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );
* when last arg === 1 queues the script for the footer
...
I want to put the jquery at the bottom because it is blocking the correct page load (google page speed recommendation).
You have to dequeue it first and then enqueue it again. The following code will do exactly what you need.
function jquery_mumbo_jumbo()
{
wp_dequeue_script('jquery');
wp_dequeue_script('jquery-core');
wp_dequeue_script('jquery-migrate');
wp_enqueue_script('jquery', false, array(), false, true);
wp_enqueue_script('jquery-core', false, array(), false, true);
wp_enqueue_script('jquery-migrate', false, array(), false, true);
}
add_action('wp_enqueue_scripts', 'jquery_mumbo_jumbo');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With