How to load jQuery in the footer

Paste the following code in your functions.php file, save it, and you’re done.

function ds_print_jquery_in_footer( &$scripts) {
	if ( ! is_admin() )
		$scripts->add_data( 'jquery', 'group', 1 );
}
add_action( 'wp_default_scripts', 'ds_print_jquery_in_footer' );

Credit: Dominik Schilling.

Leave a Reply

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