apply_filters ( 'jetpack_lazy_images_blacklisted_classes', array An )

Allow plugins and themes to tell lazy images to skip an image with a given class.

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

View in GitHub



(array) An array of strings where each string is a class.


Since: Jetpack 5.9.0


Have a note to contribute?

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

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

Facebook photo

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

Connecting to %s


  1. Rodolfo says:

    Here’s a quick example to exclude your logo (given the logo’s class “custom-logo”) from lazy loading:

    add_filter( 'jetpack_lazy_images_blacklisted_classes', 'bbloomer_exclude_custom_logo_class_from_lazy_load', 999, 1 );
    function bbloomer_exclude_custom_logo_class_from_lazy_load( $classes ) {
        $classes[] = 'custom-logo';
        return $classes;
    • mygoldenthimble says:

      How about if I want to exclude all woocomerce pictures??? But still lazy load anywhere else on my site?

    • Erez Speiser says:

      Thanks to that code snippet. It was most helpful!. Can you share what is the syntax if I want to exclude more than one class? Thanks

      • Jeremy says:

        Hi there,

        One way to exclude multiple classes would be to adjust the above example like so:

        function bbloomer_exclude_custom_logo_class_from_lazy_load( $classes ) {
          $classes[] = 'custom-logo';
          $classes[] = 'second-class';
          $classes[] = 'third-class';
          return $classes;


  2. Loayon Lou says:

    Hi! This works but still it adds noscript tag which gives w3c error when I’m using picture tag How will I fix it?

    • Jeremy Herve says:

      It’s currently not possible to remove those noscript tags. We’re tracking this issue here. I would recommend that you subscribe to the issue to follow our progress on this.

  3. Sandra says:

    I really need help creating a snippet for turning off Lazy Images only on the homepage.