WordPress 5.9 is all set to release on January 25, 2022.
While the version will bring a plethora of features, it will also improve the lazy loading of images and iframes which in turn will improve the Largest Contentful Paint (LCP) of a website.
Lazy loading of images was introduced in WordPress 5.5 and later from WordPress 5.7, the CMS also supports lazy loading of iframes.
Now, in a recent blog post, Felix Arntz (WordPress Core Committer) said, the implementation of lazy loading for images and iframes is getting a performance improvement in WordPress 5.9.
When lazy loading was introduced in WordPress 5.4, it was found that it slightly degrades the LCP performance because WordPress lazy loads nearly all the images and iframes.
After analyzing 50 popular themes, the WordPress team found that skipping lazy loading the first image or iframe of a post improves the LCP and increases the page speed by 30%.
In WordPress, we have singular and archive content pages. Both of these pages contain one or more featured images.
Now, with WordPress 5.9, the CMS will not lazy load the first image or iframe of a singular and archive page.
This new implementation is said to improve the LCP performance of the majority of themes using single-column post content. Themes having multi-column layout can use the filter (wp_omit_loading_attr_threshold) to change the number of images skipped from lazy loading. For example, a theme might use a three-column layout on its archive page. Hence, in that case, theme developers can use the aforementioned filter to change the threshold of images being skipped from being lazy-load.
The WordPress team has said that the lazy-load feature will be fine-tuned further when the support for the block-based themes will be given to the CMS core.