[Resolved] Disable lazy load of featured image.

Home Forums Support [Resolved] Disable lazy load of featured image.

Home Forums Support Disable lazy load of featured image.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2317642
    Mark

    Hi,

    My featured images for posts are pulled in using Elements, I made a ‘Block – Page Hero’ with dynamic data to pull in featured image and display above posts.

    However, I would like to disable lazy-load for this image, to help with LCP.

    Any ideas how I can do this?

    Thanks!

    #2317773
    Ying
    Staff
    Customer Support

    Hi Mark,

    Try adding skip-lazy class to the image block:
    https://www.screencast.com/t/xrcePtqr

    #2319001
    Mark

    Hi Ying,

    Thanks, I tried this but it still seems to be adding loading=lazy.

    Instead it now says:

    “<img width="1030" height="401" src="REDACTED" class=”gb-image-bec0fc6b skip-lazy” alt=”” loading=”lazy” srcset=”REDACTED 1030w, REDACTED 300w, REDACTED 1024w, REDACTED 768w” sizes=”(max-width: 1030px) 100vw, 1030px” />”

    Any ideas?

    Thanks!

    EDIT: I solved this for now by disabling WP native lazyload with:

    add_filter( ‘wp_lazy_loading_enabled’, ‘__return_false’ );

    In functions.php. I then used Autoptimize for lazy loading which gives you more control, e.g. don’t lazy load the first X images, as well as the ability to exclude lazy loading by class, filename etc.

    There may be a cleaner way of doing this while keeping WP native lazy loading.

    #2320347
    Ying
    Staff
    Customer Support

    Glad you found a way out 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.