Skip to content

WordPress lazy loading: what to keep, what to remove

Native WordPress lazy loading interacts badly with above-the-fold heroes, third-party slider plugins, and CDN delivery. The audit for what to lazy-load, what to eager-load, and what to leave native.

Since WordPress 5.5, <img> tags get loading="lazy" automatically. This is correct for 90% of images on most WordPress sites and wrong for the 10% that include the LCP hero. Add a cache plugin that also lazy-loads images, a CDN that lazy-loads above its own threshold, and an Elementor section with its own lazy-load attribute, and the same image is being lazy-loaded three times — once delaying the LCP element.

What’s happening

Native WordPress lazy loading uses the browser’s loading="lazy" attribute, which the browser handles natively and conservatively. It does not load images that are far below the fold but does load images within the initial viewport. The problem is “initial viewport” is heuristic: a hero image at the very top of the page sometimes gets lazy-loaded anyway, delaying LCP by 200-500 ms.

Plugin-based lazy loading (WP Rocket, a3 Lazy Load, Lazy Load by WP Rocket as a standalone) uses JavaScript to swap src attributes. This can produce more accurate viewport detection but introduces a JS dependency on every image render. When two systems lazy-load, they fight: the plugin’s data-src swap can preempt the browser’s native logic, sometimes delaying images that should have loaded eagerly.

How to verify

Inspect the LCP image in the rendered HTML:

curl -s https://www.example.com/ \
  | grep -o '<img[^>]*' | head -20

Look at the first few <img> tags. The hero image should NOT have loading="lazy" and ideally should have fetchpriority="high". If it does have loading="lazy", that is your LCP fix.

Check what the browser actually does:

# In Chrome DevTools → Network panel → reload with cache disabled
# Filter by image type, look at the timing of the LCP image
# A lazy-loaded image will not start loading until after layout

Use the WordPress filter to see what is being modified:

add_filter('wp_lazy_loading_enabled', function($default, $tag_name, $context) {
    error_log("lazy check: $tag_name in $context = " . ($default ? 'yes' : 'no'));
    return $default;
}, 10, 3);

The fix

  1. Keep native lazy-loading for content images below the fold: this is the right default. Do not disable it globally.
  2. Disable lazy-loading for the LCP image: identify the hero image (homepage banner, blog post featured image, product gallery main image). Use the wp_get_attachment_image filter or pass loading="eager" when calling the function. For Yoast-generated featured images, use the wp_get_attachment_image_attributes filter to swap loading=lazy for loading=eager on the first image in the loop.
  3. Add fetchpriority="high" to the LCP image: tells the browser to prioritize the image over other downloads. Combine with <link rel="preload"> in the head for above-the-fold heroes.
  4. Disable lazy-load plugins if native is already running: a3 Lazy Load and similar plugins are largely obsolete on WordPress 5.5+. WP Rocket’s lazy-load is more capable but turn off either native or WP Rocket — never both.
  5. For iframes and videos, keep lazy-loading on: native loading="lazy" on iframes is broadly supported. Embedded YouTube videos and Google Maps benefit from it. Do not lazy-load above-the-fold iframes (e.g., a contact form embed).
  6. For CDN-served images, confirm the CDN does not double-lazy: BunnyCDN Optimizer, Cloudflare Mirage, and similar features can interact badly with native lazy-load. Disable one side.

After the changes, re-measure LCP. The expected improvement when the LCP image was previously lazy-loaded is 200-500 ms — visible in field data within 28 days.

Stack Harbor audits lazy-loading per-template across enterprise WordPress hosting sites and codifies the eager-load list per layout. If your LCP image is being lazy-loaded and you cannot find which plugin is doing it, book a 30-minute review.