I’m trying to remove jquery-migrate.min.js. I tried these codes.
//Remove JQuery migrate
function remove_jquery_migrate( $scripts ) {
if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) {
// Check whether the script has any dependencies
$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
}
}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
or
*/
function isa_remove_jquery_migrate( &$scripts) {
if(!is_admin()) {
$scripts->remove( 'jquery');
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4' );
}
}
add_filter( 'wp_default_scripts', 'isa_remove_jquery_migrate' );
After I tried the plugins but I can’t remove jquery-migrate.min.js
It is still loading. screenshot: https://prnt.sc/s8qiel
How can I remove this? thanks
Based on where WP registers jQuery Migrate (https://github.com/WordPress/WordPress/blob/267061c9595fedd321582d14c21ec9e7da2dcf62/wp-includes/script-loader.php#L749) and WP's wp_dequeue_script function.. we can do something like this.
Just keep in mind that folks that have deregistered jQuery Migrate have experienced lots of issues.. this is something that needs to be changed at the WP Core level IMHO