Add this code to your WordPress theme’s functions.php file
function jquery_to_footer() { // First unregister standard jQuery wp_deregister_script('jquery'); // Then we register jQuery again, specifying the path to the jQuery include file and setting the parameters wp_register_script('jquery', includes_url('/js/jquery/jquery.js'), false, null, true); //Finally, we add the registered jQuery to the download queue wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'jquery_to_footer', 999);
Moving jQuery to the page footer can cause some problems or errors on the site, especially if your site or the plugins you use rely on jQuery loaded in the page header.
Why move jQuery to the footer. Any benefits?
Moving jQuery to the footer of a website page has several benefits.
Performance Improvement
Placing scripts at the bottom of the page allows the browser to load other resources, such as styles and images, in parallel while the scripts are loading. This can improve page load time.
Avoid Render Blocking
Moving jQuery to the bottom of the page allows the browser to render the page content before loading the script, which can prevent render blocking.