In order to assist older jQuery code to work with newer versions of jQuery, the jQuery team provided a script called “jQuery Migrate”. As a result, it logs warnings about deprecated or outdated jQuery functions in the browser console.
It is useful for debugging, but if your code is working fine and you do not wish to see warnings in the console, you can disable them.
Goal: Mute jQuery Migrate warnings
When you set jQuery.migrateMute = true, you are instructing the Migrate plugin to do the following:
The warnings should not be displayed in the browser console – even when deprecated functions are being used.
Warnings are still tracked internally (via jQuery.migrateWarnings), but they are not displayed in the console.
Here is how you can do it:-
Step 1: Locate the JavaScript file that is used globally
You should have the following file:
Edit this file /var/www/js/global_custom.js
There is a good chance that this is a file that runs custom JS for your entire website.
On a Linux server, you can open and edit this file by using the following command:
nano /var/www/js/global_custom.js
Step 2. Add this Line at the top of the File
// Set to true to prevent console output; migrateWarnings still maintained
jQuery.migrateMute = true;
It must be loaded before the jQuery Migrate script. Make sure that your HTML or layout file has the following load order:
script src="path/to/global_custom.js">/script>
script src="path/to/jquery.js">/script>
script src="path/to/jquery-migrate.js">/script>
Alternatively, if jQuery is loaded first, ensure global_custom.js runs before jquery-migrate.js.