WP Core Native Lazy Load interfering




Wordpress LScache Plugin: WP Core Native Lazy Load interfering

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi, while configuring and optimizing the plugin Lazyload for images (excluding above the fold images like post thumbnails and the site main logo by adding the classes like attachment-post-thumbnail and custom-logo) I noticed that the post thumbnails still had loading=lazy attribute. This attribute appears to be coming from the WP core lazy load function. I was able to deactivate this with add_filter( wp_lazy_loading_enabled, __return_false ) My question: why does LScache not deactivate core lazy load when the plugin lazy load is activated? from the code , it does https://github.com/litespeedtech/lscache_wp/blob/6c95240003b89ef1d4ce190f5a96eba83528cd89/src/media.cls.php#L58 Hi @CacheCrawler then it appears the filter is not enough anymore when trying the new Twenty Twenty-Three theme included in the WP6.1-RC2 release. It seems post thumbnails still have loading= lazy , at least on our dev site? Ill try tor reproduce this on a public test site without any other plugins and let you know sure thanks, please keep me posted OK, Ive prepared a test site with WP 6.1-RC3, Twenty Twenty-Three and the latest LiteSpeed Cache plugin. No other plugins activated. All caches and optimizations are OFF, except Lazy Load Images. Ive added the class wp-block-post-featured-image to the field Lazy Load Image Parent Class Name Excludes so the above-the-fold featured image is not lazy loaded. Still, that image has the attribute loading=lazy while other images and iframes on the same page do not (as expected) have that attribute anymore. It seems only the Post Featured Image block in the default Single theme template is affected. You can see it here https://dev.status301.com/2021/06/welcome-to-the-gutenberg-editor/ I will try to set up a test site as well if you disable lazyload , all the images will have loading=lazy ? and if you enable lazyload and exclude that class , the rest images dont have loading=lazy , but only these classed/excluded image has it ? Interesting? I did some more tests with the different default twenty themes, without Litespeed Cache but with a custom plugin that simply adds add_filter( wp_lazy_loading_enabled, __return_false ) and in case of T22 and T23, an extra filter seems to be needed: function disable_lazy_load_for_featured_images( $attr ) unset( $attr[loading] ) return $attr add_filter( wp_get_attachment_image_attributes, disable_lazy_load_for_featured_images ) These two themes use block Post Featured Image, which uses get_the_post_thumbnail, which apparently does NOT do a wp_lazy_loading_enabled validation before adding the loading attribute. It then passes the attributes to wp_get_attachment_image which in turn skips wp_lazy_loading_enabled validation because the loading attribute is already set? Not sure if this is WP core bug (omission) or by design but the only work-around is the wp_get_attachment_image_attributes filter, removing the loading attribute just before final HTML is generated. Ive reported the issue here https://core.trac.wordpress.org/ticket/56927



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference