Partial img lazy load with WP 5.5

I have upgraded to WP 5.5, however the majority of the images have no loading="lazy" attribute. These images are managed by 3rd party plugins, such as Slider Revolution, Essential Grid or Siteorigin…

Could it be the plugins are disabling lazy load somehow?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Whether or not the loading="lazy" attribute will be added to images from these plugins depends entirely on how those plugins are outputting their images. As outlined in this blog post, WordPress 5.5 only adds the loading="lazy" attribute automatically to the following images:

  • images within post content (the_content)
  • images within post excerpts (the_excerpt)
  • images within text widgets (widget_text_content)
  • avatar images (get_avatar)
  • template images using wp_get_attachment_image() (wp_get_attachment_image)

So if these plugins are not adding images to the post content directly, or using the wp_get_attachment_image() function, then their images will likely not get this attribute. From experience I can say that many plugins and themes fail to use wp_get_attachment_image() even when it would be appropriate, and thus miss out on these features.

Adding the attribute to the images should be trivial, but whether that’s something you could do yourself, or something the plugin’s developer would need to do, is something that would be specific to each plugin. You will need to approach each plugin’s developer, or consult the their developer resources, to find out. WordPress 5.5 is quite fresh though, so you may just want to give it a little time before plugins add support.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x