Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Removes jQuery Migrate script from WordPress. Reason: modern browsers don't need this anymore.
* 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
You can’t perform that action at this time.