How to include data-no-lazy in lazyload




Wordpress LScache Plugin: How to include data-no-lazy in lazyload

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hi, I am utilizing lazyload on the site. There are a number of elements on the site that have the data-no-lazy attrib, which Litespeed honors and does not lazyload those images. However, I would like to override that behavior (at least for testing purposes.) Is there a way that I can override the data-no-lazy behavior of Litespeed and still load the images lazyload? There is the litespeed_media_lazy_img_excludes API method but I couldnt find documentation on that and dont know if it can actually override the default data-no-lazy behavior. Thanks, -Norm Hi, sadly no , and that filter is to exclude images , not to include only way to get it is to modify the source code in /src/media.cls.php , around line 576-ish , you will see the attribute check condition Best regards, Thanks for the response. I thought that might be the answer. Thanks for letting me know where in the source I can look? I will only modify it for testing purposes though so I can try out a couple of things. Maybe this could be added as a filter or option at some point. Thanks, -Norm usually these attributes were added for certain reason , and its better safe than sorry , to obey it instead of forcefully bypass/ignore it Yeah, Im using a page builder and the module vendor put in the no-lazy-load attrib because there was another caching service (not Litespeed) that was having difficulty rendering galleries. So the vendor added it to all of the various grid modules. Ive done some testing with Litespeed, and with the combination of LQIP and lazyload Im not seeing the same issues that were reported with the other caching service. So I can either go back to the page builder vendor and ask them to modify all of their various modules to add in a WP filter, and then put in my code the filters for all the various modules? or I can just globally disable the no-lazy-load and then add a CSS class or selector to force lazyload exclude anywhere I notice a problem. ? at least that was my plan you can use this filter function remove_data_no_lazy( $content ) $content=str_replace( data-no-lazy, , $content ) return $content add_filter( litespeed_buffer_before, remove_data_no_lazy, 0) to modify it before LSCWP processes , didnt test though , but the idea should work Thanks qtwrk! I tested it out and that worked ? removed the data-no-lazy from all the elements. I only made one small change to the code for the attrib. Heres the code I used: function remove_data_no_lazy( $content ) $content=str_replace( data-no-lazy=1 , , $content ) return $content add_filter( litespeed_buffer_before, remove_data_no_lazy, 0) Thanks again.



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



Reference