Last Updated: February 25, 2016
· mkdizajn
Kreso 300x300

Wordpress load jquery in the footer!

By default Wordpress will load jquery lib in the header if you include it in function.php like this:

wp_enqueue_script( 'jquery' );

But if you'd like to be loaded in the footer so that maybe your page would load much faster with css and html only.. you can use this snippet:

function addthemejs() { 
    wp_deregister_script( 'jquery' ); // remove standard jquery
    wp_enqueue_script( 'jquery', get_template_directory_uri() .'/js/jquery.js' ,,, true );

//  call the enqueue hook

add_action('wp_enqueue_scripts', 'addthemejs');

cheers, k

Say Thanks

1 Response
Add your response

Pm2ysey6 normal

You need to be careful with doing this, as some plugins load jQuery dependent scripts into the header of your site which can cause problems.

However, if this isn't an issue you should definitely place jQuery into the footer

over 1 year ago ·