apply_filters ( 'lazyload_is_enabled', bool true )

Whether the lazy-images module should load.<p>This filter is not prefixed with jetpack_ to provide a smoother migration process from the WordPress Lazy Load plugin.</p>

Source file: modules/lazy-images/lazy-images.php

View in GitHub

Parameters

true

(bool) true Whether lazy image loading should occur.


Changelog

Since: Jetpack 5.6.0


Notes

Have a note to contribute?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Comments

  1. Leni Neto says:

    Is there a way to use this filter, or even manually set an image to lazy load? I noticed photon users a preg_match_all to find images using an tag but it doesn’t find background images.

    • Jeremy says:

      That filter will not allow you to enable Lazy Load for images that are not lazy loaded today.

      If Lazy Images does not pick up some of your images right away, could you start a new issue here and give us some details about your theme and the images that don’t get picked up? We’ll see if we can edit Jetpack so it starts taking those images into account.

      Thank you!

      • Leni Neto says:

        Hi Jeremy,

        Thanks for your reply.
        I see the preg_match_all function on Jetpack is searching for “”.
        Problem for me is my theme (like many others) uses parallax images and those images are set as backgrounds, like this:

        <

        section id=”section1″ data-overlay=”5″ data-vc-parallax-image=”https://image.url”>
        ::before

        <

        div class=”background-image-holder” style=”transform: translate3d(0px, -1262.31px, 0px); background: url(“https://image.url”); opacity: 1;”>

        As you can see, the image is loaded as the layer background, and Jetpack does not catch that.

      • Jeremy says:

        That’s a good point. Do you think you could open an issue here with more details about your theme, so we can consider how to add support for that theme and others like it?

        Thank you!

      • Leni Neto says:

        Done! And sorry about my incomplete response here, I didn’t notice the code I posted here got completely broken.

  2. Is there a way to exclude certain images on the page from being lazy loaded?
    I want them to load normally.
    For example on archive page where posts have Masonry layout, lazy load changes layout after you scroll to images that where not in viewport.
    I know that I can do relayout on masonry after lazy load but that’s going to be very jittery.