Created
January 28, 2019 02:17
-
-
Save chuckreynolds/1b8a6f54330893e1eba614527ad7dd45 to your computer and use it in GitHub Desktop.
Removes jQuery Migrate script from WordPress. Reason: modern browsers don't need this anymore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove jQuery Migrate script | |
*/ | |
function ryno_remove_jquery_migrate( $scripts ) { | |
if ( 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', 'ryno_remove_jquery_migrate' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment