How to Remove the jQuery Migrate Script from WordPress
If your WordPress project uses jQuery, then by default, WordPress also loads the jQuery Migrate script along with it. In 99% of cases, you don’t actually need this script. jQuery Migrate restores support for outdated features that have already been removed from the main jQuery library.
You can determine whether jQuery Migrate is loaded by checking for a message in your browser’s console

or by inspecting the HTML code of your website.

In most cases, the jQuery Migrate script doesn’t do anything useful and only adds extra load to your website, increasing the page loading time. This negatively affects user experience and can also harm your SEO. You can read more about how loading speed affects SEO in our related article — “Why Website Loading Speed Matters for SEO”.
There are several ways to disable the jQuery Migrate script. Personally, I prefer the method that doesn’t require any third-party plugins — simply by adding a small piece of code to your theme’s functions.php file.
PHP
// functions.php
/**
* delete jquery-migrate
*/
add_action('wp_default_scripts', function( $scripts ) {
if ( ! empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff(
$scripts->registered['jquery']->deps,
['jquery-migrate']
);
}
});
The WordPress CMS is a great tool, but WordPress itself and its plugins often include unnecessary scripts and styles, thereby slowing down the site’s loading time. This, in turn, negatively impacts SEO. Therefore, you need to be careful about what and how you include. And in cases like jQuery Migrate, optimization is essential.
Similar posts:
-
Classic WordPress widget (plugin) of NBU exchange rates (Ukraine)
WP Currency NBU - classic NBU (National Bank of Ukraine) exchange rate widget for WordPress. The widget displays the USD (US Dollar), EUR (Euro), PLN (Polish Zloty) excha...
-
Step Options Plugin for WordPress
At some point, I needed a way to display identical content blocks across multiple pages, with the ability to manage and update them easily from the WordPress admin panel....
-
Why Website Loading Speed Matters for SEO
Website loading speed plays a crucial role in modern SEO strategies. Search engines like Google prioritize websites that offer fast and smooth user experiences. A slow-lo...
Excellent web site. Lots of helpful info here. I am sending it to a few friends ans additionally sharing in delicious. And certainly, thank you for your sweat!