The newest WordPress update, version 6.4, brings improvements to how scripts load on the front end, resulting in faster page load times and improved site performance.
These changes are part of WordPress’s core and bundled themes. They optimize the process of loading scripts by using two attributes: “defer” and “async.”
The “async” attribute instructs the browser to load scripts in the background, while “defer” loads them after the rest of the page has loaded. These enhancements greatly accelerate the time it takes for a page to become interactive.
Improved Page Loading Speed through Intelligent Script Handling
With this update, WordPress ensures faster page loading for website visitors. In particular, it enhances the Core Web Vitals‘ first contentful paint (FCP) metric, which determines how quickly the page initially appears.
Behind the Scenes: What did WordPress do?
In the past, the ability to add these attributes was not standardized. However, with the introduction of a dedicated API in WordPress 6.3 and its full implementation in 6.4, developers now have a standardized method for controlling when their scripts load.
Furthermore, this update has moved the majority of deferred scripts back into the <head> section since they no longer hinder rendering. This adjustment allows the browser to discover and cache these scripts earlier, thus enhancing overall performance.
A few lower-priority scripts, such as the one for comment replies, remain in the footer but are loaded asynchronously using ‘async’ to run in parallel with other resources.
How is it beneficial for Website Visitors?
For website visitors, the update translates into faster loading times for pages containing WordPress content. There will be less ‘jank,’ or shifting around of page elements, after the initial page load.
These changes establish the foundation for even more substantial optimizations in the future.