-
-
Notifications
You must be signed in to change notification settings - Fork 0
Embed jQuery Migrate
This is a similar code as the one used for the jQuery - Embed jQuery, and it shares some of the code and exactly the same approach.
And while the embedding of JavaScript inside the main HTML content is not recommended, embedding jQuery is one solution to the render-blocking issue.
- jQuery Migrate is no longer render-blocking
- Faster execution of the page
- jQuery Migrate can't be cached by the browser
- It will increase the size of the main HTML by 95KB
The script is run on the website frontend-only; it doesn't affect jQuery Migrate loading on the admin side. It is loading jQuery that is part of WordPress, and places it in the page HEAD, at the very start of the HEAD tag. After that, it hooks into WordPress default scripts registration code, it finds the jQuery Migrate there and replaces the registered script URL with an empty string. This way, jQuery Migrate is still registered, it will not break any code that depends on it, but WordPress will not print the jQuery Migrate script tag.