#StackBounty: #php #jquery #scripts #wp-dependencies Loading jQuery in the footer after removing jQuery migrate?

Bounty: 50

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?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.