Loading jQuery in the footer after removing jQuery migrate?

by Brett   Last Updated September 23, 2018 16:08 PM

I am removing jQuery migrate in WordPress in this way:

add_filter( 'wp_default_scripts', 'remove_jquery_migrate' );

function remove_jquery_migrate( &$scripts ){
        $scripts->remove( 'jquery');
        $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.2.1');

I'm confused at how you set the in_footer property with the WP_Dependencies::add function, I tried the below but it didn't work:

$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.2.1', ['in_footer' => true]);

What is the correct way to do this?

Related Questions

RequireJS in custom theme. Working Example

Updated April 23, 2015 21:03 PM

Script not loading when depending on jQuery

Updated October 06, 2017 16:08 PM

Using jquery with wordpress using wp_enqueue_scripts

Updated December 14, 2017 02:08 AM

How to add unique image class to Wordpress

Updated July 28, 2017 20:08 PM