- This topic has 5 replies, 4 voices, and was last updated 4 years, 8 months ago by
Elvin.
-
AuthorPosts
-
May 12, 2021 at 6:00 pm #1776619
Manu
Hi Generatepress team,
Is there any way to remove loading=”lazy” for featured images on the single post?Thank You
May 12, 2021 at 9:23 pm #1776727Elvin
StaffCustomer SupportHi there,
The default WordPress lazyload doesn’t allow you to disable this specific to an image.
Consider using a plugin to manage lazy loading on your site.
Have plugins like WP Rocket set the lazy load for you, and then disable featured image lazy load by following their documentation here – https://docs.wp-rocket.me/article/15-disabling-lazy-load-on-specific-images
July 25, 2021 at 8:27 pm #1870741Ryan
I also had this question, in addition to possibly disabling it on an certain image class. This does seem to be possible at least for featured images like the original question. They have some documentation here https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/ but I can’t figure it out.
July 26, 2021 at 4:43 am #1871215David
StaffCustomer SupportHi there,
try the code i provided here:
https://generatepress.com/forums/topic/how-to-resize-featured-image-on-mobile/#post-1858309
Although my interpretation is above the fold images should ‘ignore’ the lazy attribute:
https://web.dev/browser-level-image-lazy-loading/#distance-from-viewport-thresholds
But who knows 🙂
July 27, 2021 at 4:10 pm #1873597Manu
Hi,
I don’t know whether this is the correct approach. Here is what I tried;First, I disabled the default Lazy load on WordPress using the code:
add_filter( 'wp_lazy_loading_enabled', '__return_false' );Then enabled the lazy load images using a cache plugin/ optimization plugin. In my case, it is LiteSpeed Cache and excluded the featured image class from lazy loading.
Correct me if I am doing something wrong.
July 27, 2021 at 6:08 pm #1873652Elvin
StaffCustomer SupportThen enabled the lazy load images using a cache plugin/ optimization plugin. In my case, it is LiteSpeed Cache and excluded the featured image class from lazy loading.
That’s actually a good way of doing it. WP’s default lazy load is lacking so it’s better to replace it with a plugin with more control like Litespeed cache or WP Rocket that lets you target an image specifically through its class selector.
-
AuthorPosts
- You must be logged in to reply to this topic.