Skip to content

Instantly share code, notes, and snippets.

@carlitoescobar
Created February 25, 2018 20:44
Show Gist options
  • Save carlitoescobar/7a0c1fcd136c70f2658eccbff81b3671 to your computer and use it in GitHub Desktop.
Save carlitoescobar/7a0c1fcd136c70f2658eccbff81b3671 to your computer and use it in GitHub Desktop.
Query Migrate is a script meant to create a downward compatibility of older jQuery applications. The “normal” and modern jQuery version does not support all old applications anymore. While this won’t affect more than 5% of all WordPress website, WordPress loads the pretty sizeable script by default. Here’s an easy way to turn it off:
<?php
/**
* Dequeue jQuery Migrate Script in WordPress.
*/
if ( ! function_exists( 'evolution_remove_jquery_migrate' ) ) :
function evolution_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', 'evolution_remove_jquery_migrate' );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment