Skip to content
Performance

Fix native lazy loading not working for images

Why loading="lazy" seems ignored on WordPress images and iframes: width and height, above-the-fold images, plugin conflicts and how to test properly.

By WP24×7 engineers5 min readPublished May 30, 2021Updated November 29, 2026

At a glance

If loading=lazy seems ignored on WordPress images or iframes, the attribute is usually working as designed, the image sits near the top of the page, a plugin is fighting it or the markup lacks width and height. This guide gives a nine-point checklist, a proper DevTools test, code to keep the main image eager and notes on SEO and speed.

Updated November 29, 2026

  • For owners and developers whose lazy loading does not seem to work
  • Common causes image near the top, missing width and height, a second lazy loader, background images
  • WordPress adds loading=lazy to images since 5.5 and iframes since 5.7
  • Since 5.9 core skips the first content image
  • Test DevTools Network tab, Img filter, reload at the top, then scroll
  • Rule eager for what visitors see first, lazy for the rest
  • Help speed optimization and support

You added loading="lazy" and the browser still downloads everything at once. Usually the attribute is working as designed, an image sits near the top of the page, a plugin is fighting it, or the markup lacks width and height so the browser cannot reserve space. Work through the checks below before changing anything.

Back up and test changes on staging. Use a child theme or a small plugin for code.

Which cause fits which symptom?

SymptomLikely cause
First image not lazyBy design since WordPress 5.9
Everything loads at once on a short pageImages inside the browser's distance threshold
Images load twice or neverA second lazy loader swapping src
Layout jumps as images appearMissing width and height
Background image still loadsThe attribute is not supported there
Embed still loads at onceCreated by JavaScript, no attribute

What does native lazy loading do?

The loading="lazy" attribute tells the browser to postpone fetching an image or iframe until it is near the visible area. It saves bandwidth for content that visitors never scroll to. Browsers decide the distance themselves, and it can be large on fast connections, so images a few screens down may still load early. That is normal and not a bug.

WordPress adds loading="lazy" automatically to images (since 5.5) and iframes (since 5.7) it prints through core functions, such as post content and wp_get_attachment_image(). Since 5.9, core skips the attribute for the first content image, and in later releases it also marks the likely largest image with fetchpriority="high", because lazy loading the main image makes the page feel slower.

Why is it not working? A checklist

  1. The image is near the top

    Anything in the first screen loads immediately. Test with an image far below the fold.

  2. Missing width and height

    Without them the browser cannot reserve space, so images may load early or shift the layout when they appear. WordPress adds dimensions for media-library images. Hard-coded theme images, images in custom HTML and third-party embeds often lack them. Add them:

Eager for what visitors see first, lazy for the rest

Which attribute values matter?

AttributeValueUse for
loadinglazyImages and iframes below the fold
loadingeagerThe main image the visitor sees first
fetchpriorityhighThe likely largest image in the first screen
width and heightIntrinsic sizeEvery image, so space is reserved

How do I test it properly?

  1. Open

    the page in a private window with the browser's DevTools.

  2. Go to

    the Network tab, tick Disable cache and filter by Img (or Doc for iframes).

  3. Reload

    at the very top of the page, without scrolling.

  4. Note

    which images are requested. Scroll slowly and watch new requests appear for images lower down.

Also look at the Performance insights or Lighthouse's "Defer offscreen images" and "Largest Contentful Paint image was lazily loaded" audits. The second one tells you the opposite problem exists: the main image is lazy, so it loads later than it should.

How do I stop lazy loading on the important image?

The largest image in the first screen, often a hero or featured image, should load at once.

In your template, pass attributes when printing it:

echo wp_get_attachment_image(
	$attachment_id,
	'large',
	false,
	array(
		'loading'       => 'eager',
		'fetchpriority' => 'high',
	)
);

Think before disabling it widely, because lazy loading below the fold remains useful. The goal is: eager for what the visitor sees first, lazy for the rest.

How do I add it to images WordPress does not touch?

For images printed by a theme or custom HTML, add the attributes yourself in the template, as above. For images inside content that skipped the filters, such as a text widget, core's functions may not apply it, so edit the markup directly or use a trusted plugin's setting. Avoid regex tricks on the whole page output, which can break scripts and inline data.

Does lazy loading hurt SEO?

Native lazy loading is understood by Google's crawler, which renders pages and loads images. Problems appear with JavaScript-only loaders that never put the real src into the page. Use the native attribute where you can, and check key pages in the URL Inspection tool in Search Console.

What else matters for speed?

Right-sized, compressed images and modern formats help more than any attribute. See serving WebP images with Nginx and EWWW. If your pages still feel slow after these checks, our WordPress speed optimization service profiles the page and fixes the largest causes, and our support team can help with plugin conflicts.

Pages still slow?

Tell us which pages and a person will measure before quoting.

FAQ

Questions people ask

13 answers. Can't find yours? Ask an engineer.

Why does lazy loading not work on the first image on my page?

It should not. Images visible without scrolling must load at once, and since WordPress 5.9 core deliberately leaves the loading attribute off the first content image to protect load speed.

Link to this answer
Do iframes support native lazy loading?

Yes, via loading="lazy" in modern browsers, and WordPress adds it to iframes since 5.7. Embeds produced by plugins or scripts may not carry it.

Link to this answer
How can I tell if an image is lazy-loaded?

Open DevTools, the Network tab, filter by Img, reload at the top of the page, and see whether images far down only appear in the list after you scroll.

Link to this answer
Why is lazy loading not applied to my first image?

It should not be. Images visible without scrolling must load at once, and since WordPress 5.9 core leaves the loading attribute off the first content image to protect load speed.

Link to this answer
Why do images a few screens down still load early?

Browsers decide the distance themselves, and it can be large on fast connections, so images a few screens down may load early. That is normal and not a bug.

Link to this answer
Why do width and height matter?

Without them the browser cannot reserve space, so images may load early or shift the layout when they appear. WordPress adds dimensions for media-library images, but hard-coded images, custom HTML and embeds often lack them.

Link to this answer
Can two lazy loaders conflict?

Yes. JavaScript libraries that swap src for data-src can conflict with native loading, so images load late, never or twice. Run only one method.

Link to this answer
Does native lazy loading work on CSS background images?

No. The attribute is for img and iframe elements. Use an img element or an Intersection Observer script for background images.

Link to this answer
How do I test lazy loading properly?

Open DevTools in a private window, go to Network, tick Disable cache, filter by Img, reload at the top without scrolling, note requests, then scroll slowly and watch new requests appear for lower images.

Link to this answer
How do I stop lazy loading on the main hero image?

Print it with loading set to eager and fetchpriority set to high, for example through wp_get_attachment_image attributes. For a whole context use the wp_lazy_loading_enabled filter, but think before disabling it widely.

Link to this answer
Does lazy loading hurt SEO?

Native lazy loading is understood by Google's crawler. Problems appear with JavaScript-only loaders that never put the real src into the page. Check key pages in the URL Inspection tool in Search Console.

Link to this answer
Why does a YouTube embed not lazy load?

An embed created by JavaScript rather than printed as an iframe has no attribute. Use the plugin's own setting or a facade that loads the real embed on click.

Link to this answer
What else helps speed more than an attribute?

Right-sized, compressed images and modern formats help more than any attribute. If pages still feel slow after these checks, speed optimization profiles the page and fixes the largest causes.

Link to this answer

Keep reading

Want an engineer on it?

Tell us what is wrong in plain words. A person reads it, today.