,

Lazy loading and srcset for WordPress media in 2026

A 2026 reference on wordpress lazy loading srcset behaviour, what core does for you, and what still needs configuration.

Developer workspace laptop

WordPress lazy loading srcset behaviour quietly improved several times since 2020. In 2026 it is more capable than most theme developers realise. This guide explains what WordPress does by default, what it does not, and where a media offload plugin fits in.

What WordPress does for you by default

Since version 5.5 WordPress adds loading=”lazy” to images below the fold automatically. Since 6.3 it tries to skip the LCP image so it loads eagerly. Both behaviours are filterable.

For most themes the defaults are correct. For some custom themes the heuristic misses, and the LCP image gets lazy loaded by mistake.

How srcset works in WordPress

WordPress generates several image variants on upload, then assembles them into a srcset attribute on output. Modern browsers pick the right variant based on viewport and pixel density. This is automatic if you use the_post_thumbnail or wp_get_attachment_image.

Custom templates that hard code img tags often skip this. Switch to the helper functions and you get srcset for free.

Keep the LCP image eager

The Largest Contentful Paint image must load eagerly. If your theme lazy loads it by mistake, LCP suffers visibly. Add loading=”eager” and fetchpriority=”high” to the hero image in the template, not the markup.

A small theme tweak here is often worth a full second of LCP improvement.

Why offload makes srcset noticeably faster

Lazy loading and srcset both assume image delivery is fast. If your origin is slow, no amount of clever loading attributes saves you. Defyn Media Offload rewrites every srcset variant to a CDN URL so the browser fetches the right size from the right edge node. The combination is what makes the difference on mobile.

Without offload, lazy loading just delays a slow request. With offload, every srcset variant arrives quickly when it is needed.

Common mistakes

Lazy loading the LCP image. Missing srcset on hand written img tags. Skipping width and height attributes, which causes layout shift. Putting too many resources behind preload, which crowds the network.

Fix these in order and you are most of the way to a green Core Web Vitals score.

Frequently asked questions

Does wordpress lazy loading srcset work on background images?

No. loading=”lazy” only applies to img and iframe elements. Background images need a different approach, usually with IntersectionObserver.

Why is my LCP image being lazy loaded?

Likely the heuristic misjudged which image was the LCP. Set loading=”eager” and fetchpriority=”high” explicitly in the template.

How many srcset variants should I generate?

Three to five is enough for most themes. More than that wastes disk and slows uploads.

Should I disable native lazy loading?

No. It is the right default. Override it only for the specific image that should load eagerly.

Claire Smith Avatar
Sponsored Loved this story? Defyn turns articles like this into the websites your competitors wish they had. Talk to us → defyn.com.au