Some images are not LazyLoaded
- Some images are not lazyloaded
- PageSpeed lists some images under "defer offscreen images"
If you've already activated LazyLoad, and have verified the page is cached, but are finding some that are not LazyLoaded, there's a few possible reasons.
WooCommerce product gallery
These images user the data-src attribute which is on the compatibility list below.
The images are excluded for compatibility
When the code of the image contains certain attributes which are known to be used for conflicting purposes, they are automatically excluded.
If you want to check this for your site:
- Visit your page while bypassing WP Rocket, by adding ?nowprocket to the URL, e.g. http://example.com?nowprocket
- Go to View > Page Source to see the HTML
- Find the image that isn't LazyLoaded. Check the <img> tag for any of the following attributes which will cause the image to be excluded from LazyLoad:
Conflict with ShortPixel Global WebP rewrite
When this feature in ShortPixel is activated, our LazyLoad doesn't work correctly.
The markup isn't supported
This is most commonly related to background images, which need to be in a specific format to be LazyLoad-ed.
A common case is background images from Elementor which are loaded in separate CSS files instead of in the HTML directly. In that case you may try this plugin (no affiliation with WP Rocket): https://wordpress.org/plugins/lazy-load-background-images-for-elementor/
Conflict with another LazyLoad script
If your theme or another plugin is also adding LazyLoad, this could cause conflicts and our LazyLoad may not work as expected.
The image is injected into the page after it loads