WordPress to include Lazy-Loading for all Images

WordPress have announced that WordPress 5.4 may include image lazy-loading by default on the platform. The lazy-loading feature will enable the “loading” HTML attribute on all IMG elements. This will mean that WordPress publishers will no longer need to use JavaScript or third party plugins to lazy-load their images.

What Is Lazy-loading?

The lazy-loading HTML attribute tells a browser to either wait before downloading an image or to download it right away.
There are three kinds of lazy-loading attributes but only two that make a difference to how your images are loaded when a page is first opened in a browser:

1. Lazy
2. Eager

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

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

WordPress 5.4 Release Date

WordPress 5.4 is planned to release on March 31, 2020. This date is dependent on how ready the release is.

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  include a loading attribute. In other words, to prevent an image from being lazy-loaded, it is recommended to specify loading=”eager”.”

According to the WordPress, the lazy-loading attributes will be implemented in a manner that makes it easy to remove them. This is important in case future browsers begin lazy-loading all images by default, without the need for a loading attribute.

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

Test Drive WordPress Lazy-Loading
The WordPress team have also released a WordPress lazy-loading plugin designed for testing purposes. WordPress Developers who wish to test it and provide feedback can download the plugin and give it a try from here.

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

Comments are closed.