How to move jquery.js to the footer

Professional and affordable website design. Based in King's Lynn, Norfolk.

How to move jquery.js to the footer

If Google PageSpeed Insights shows wp-includes/js/jquery/jquery.js in Eliminate render-blocking JavaScript and CSS in above-the-fold content then this means that it needs moving to the footer of your site. The way to do this is put the following in your theme’s functions.php file.

// Move jQuery to the footer
wp_scripts()->add_data( ‘jquery’, ‘group’, 1 );
wp_scripts()->add_data( ‘jquery-core’, ‘group’, 1 );
wp_scripts()->add_data( ‘jquery-migrate’, ‘group’, 1 );

Leave a Reply

Your email address will not be published. Required fields are marked *