Skip to content

Instantly share code, notes, and snippets.

@ckanitz
Created June 11, 2024 14:34
Show Gist options
  • Save ckanitz/3378fbe3103edd2fbf1fe03cf2569376 to your computer and use it in GitHub Desktop.
Save ckanitz/3378fbe3103edd2fbf1fe03cf2569376 to your computer and use it in GitHub Desktop.
WordPress: Remove jQuery Migrate Warnings
/**
* Remove jQuery Migrate.
*
* @see https://tenor.com/ovzn.gif
*
* @param \WP_Scripts $scripts The WP_Scripts instance.
*/
public function remove_jquery_migrate( $scripts ) {
if ( ! empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, array( 'jquery-migrate' ) );
}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate', 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment