Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5

Why is there a constant notice,

JQMIGRATE: Migrate is installed, version 1.4.0

that points to load-scripts.php in my console when I updated my theme to WordPress 4.5, and how can it be removed?

It’s not an error, but it’s always present in my console, and I really don’t see what’s the point of it. Should I update something, or make some changes to my code?

Maybe I have a bit of OCD, but usually when I inspect the site, I like to see errors and real notices that point to an issue in my console…

EDIT

WordPress 5.5 removed jQuery Migrate script, as a preparation step for updating jQuery to the latest version in 5.6. So the notice should be gone.

Updating jQuery version shipped with WordPress

7

WordPress uses the jQuery migrate script to ensure backwards compatibility for any plugins or themes you might be using which use functionality removed from newer versions of jQuery.

With the release of WordPress 4.5, it appears they have upgraded the version of jQuery migrate from v1.2.1 to v1.4.0 – Having a quick scan through the code reveals that v1.4.0 logs that the script is loaded regardless of whether or not the migrateMute option is set, in both the uncompressed and minified versions.

The only way to remove the notice is to ensure all your plugins/theme code don’t rely on any old jQuery functionality, and then remove the migrate script. There’s a plugin out there to do this, but it’s quite a simple method that can just be placed in your theme’s functions file or similar:

add_action('wp_default_scripts', function ($scripts) {
    if (!empty($scripts->registered['jquery'])) {
        $scripts->registered['jquery']->deps = array_diff($scripts->registered['jquery']->deps, ['jquery-migrate']);
    }
});

Please note that this is not considered best practice for WordPress development and in my opinion the migrate script should not be removed just for the sake of keeping the developer console clean.

Leave a Comment