The latest update to WordPress, version 6.4, includes changes to how scripts are loaded on the front end that will improve page load times and performance for many sites.
Script loading strategies are now incorporated into the core and bundled themes of WordPress, improving the performance of loading scripts with defer and async attributes.
These attributes instruct the browser to load scripts in the background (async) or after the rest of the page has loaded (defer), which can significantly speed up the time it takes for a page to become interactive.
Faster Page Loads With Intelligent Script Handling
For website visitors, pages with WordPress content will load faster after an update, specifically improving the CWV’s first contentful paint (FCP) metric, which affects how fast the page first appears.
Behind the Scenes: How WordPress Achieved This
Previously, the ability to add these attributes wasn’t standardized. With the introduction of a dedicated API in WordPress 6.3 and the full implementation in 6.4, developers now have a standardized way to control when their scripts load.
Additionally, the update moves the most deferred scripts back into the <head> section since they no longer block rendering. This allows the browser to discover and cache them earlier, improving performance.
A few lower-priority scripts, like the one for comment replies, will remain in the footer but are loaded asynchronously with ‘async’ so they load in parallel with other resources.
Real-World Impacts For Website Visitors
For website visitors, pages with WordPress content will load faster after updating. There will be less “jank” or shifting around of page elements after the page first appears.
These changes lay the groundwork for even better optimizations in the future.
Featured Image: Wirestock Creators/Shutterstock