Images without lazy loading on WordPress

Images outside the visible area (below the fold) are loaded immediately instead of waiting for the user to scroll to them.

Why it matters

Unnecessarily loading invisible images slows LCP and consumes bandwidth on mobile, often limited or paid for by the user.

How to fix

  1. 1

    WordPress 5.5+: native lazy loading (automatic)

    Since WordPress 5.5, the loading="lazy" attribute is automatically added to images added via the editor. Verify you have not disabled this feature.

  2. 2

    Enable manually on all images

    php
    add_filter('wp_lazy_loading_enabled', '__return_true');
    
    // Pour les images dans le contenu
    add_filter('the_content', function($content) {
      return str_replace('<img ', '<img loading="lazy" ', $content);
    });
  3. 3

    Do not put loading="lazy" on the LCP image

    html
    <!-- The hero image (LCP) must NOT have lazy loading -->
    <img src="hero.webp" width="1200" height="600" fetchpriority="high" alt="...">
    
    <!-- Below-the-fold images have lazy loading -->
    <img src="produit.webp" width="300" height="300" loading="lazy" alt="...">

Ready to fix this issue on your site?

Audit my site for free →