fbpx

Blog

WordPress 5.4 Will Add Lazy-Loading to All Images

Thrive Business Marketing company logo

In an announcement made by WordPress, WordPress 5.4 could feature image lazy-loading by default, which enables the “loading” HTML attribute on all IMG elements. WordPress publishers will not have to use JavaScript or third party plugins for lazy-loading their images.

The lazy-loading HTML attribute tells a browser to wait before downloading an image, or to download it right away. Basically, there is no need for JavaScript here.

There are three kinds of lazy-loading attributes but only two that really matter:

  1. Lazy
  2. Eager

Lazy means to wait until the users browser viewpart is within a certain distance before downloading the image. This behavior speeds up a users experience on WordPress. Lazy will be enabled in WordPress 5.4 by default.

The “eager” attribute tells the browser to immediately download the image.

Currently, WordPress 5.4 is set to release on March 31, 2020, but is subject to change depending on how ready the release is. Even then, WordPress has has a good track record of meeting their deadlines.

According to the WordPress announcement:

“The implementation seeks to enable lazy-loading images by default, providing the loading attribute with value lazy on the following img tags:

Images in post content
Images in post excerpts
Images in comments
Images in text widget content
Individual images rendered via wp_get_attachment_image()
Avatar images rendered via get_avatar()

Note that loading=”lazy” will only be added if the respective tag does not yet include a loading attribute. In other words, to prevent an image from being lazy-loaded, it is recommended to specify loading=”eager”.”

The lazy-loading attribute are going to be implemented in a manner that makes it easy to remove them, based on WordPress comments. This is important, as future browsers will start lazy-loading images by default, without needing a loading attribute.

According to Google (indicated via Web.dev), there are plans to enable lazy-loading to all images when a browser in the Lite mode (known before as Data Saver mode) automatically.

A WordPress lazy-loading plugin designed for testing purposes has been released by the company. If you want to test it and give it feedback, download the plugin and give it a go.

Read the official WordPress announcement here:
Lazy-Loading Images in WordPress Core

SourceRoger Montti

Are You Ready To Thrive?

Or send us a message

Name(Required)

Categories