SEO News

WordPress Update Improves Page Speed With Smarter Script Loading


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

Previously, JavaScript files included in WordPress themes and plugins were loaded without specifying that they should load asynchronously. This meant they blocked other downloads and delayed page rendering while they were fetched and executed.

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

JavaScript files for blocks like navigation menus and embedded media from WordPress.com now has ‘defer’ added when enqueued. The wp-embed script for displaying embedded posts now utilizes ‘defer.’

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



Source link : Searchenginejournal.com

Related Articles

Back to top button
Social media & sharing icons powered by UltimatelySocial
error

Enjoy Our Website? Please share :) Thank you!