# WordPress lazy loading

> WordPress adds loading="lazy" itself. See which images it covers, how it protects the LCP image with fetchpriority, and the filters to override it.

Canonical: https://scaplet.com/seo/wordpress/lazy-loading

Guide WordPress WordPress · Performance

WordPress adds loading="lazy" itself. See which images it covers, how it protects the LCP image with fetchpriority, and the filters to override it.

4 min

read

4

sources

Oct 29, 2026

updated

Scaplet Editorial Team

author

In one line

Since WordPress 5.5, core adds the native `loading="lazy"` attribute to images that have width and height attributes. Since 6.3 it also sets `fetchpriority="high"` on the image it judges most likely to be the LCP image, and never combines the two on one image. You only need to act when a hero image, or a theme template, gets the wrong attribute.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2Flazy-loading%20(%22WordPress%20lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2Flazy-loading%20(%22WordPress%20lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2Flazy-loading%20(%22WordPress%20lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fseo%2Fwordpress%2Flazy-loading%20(%22WordPress%20lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 4 minutes.

1. [What WordPress already does 01](#what-wordpress-already-does)
2. [Why the LCP image must not be lazy 02](#why-the-lcp-image-must-not-be-lazy)
3. [Override it where core guesses wrong 03](#override-it-where-core-guesses-wrong)
4. [Gotchas 04](#gotchas)
5. [Check it worked 05](#check-it-worked)

_01_Core behavior by version

## What WordPress already does

The 5.5 dev note documents filters for controlling this, not a setting. WordPress core handles it when the page is output, in the same pass that adds `srcset` and `sizes`. The rules below come from the WordPress core dev notes for 5.5 and 6.3 and the developer reference for `wp_get_loading_optimization_attributes()`.

Behavior

### Adds `loading="lazy"` to `img` tags that have width and height attributes

Since

5.5

Detail from the docs

Both dimension attributes must be present, to reduce layout shifting

Behavior

### Back-fills `width` and `height` on images that lack them

Since

5.5

Detail from the docs

Only works if the image is a WordPress attachment and the `img` tag has the `wp-image-$id` class

Behavior

### Covers post content, excerpts, text widgets, avatars and `wp_get_attachment_image()` output

Since

5.5

Detail from the docs

The five contexts are `the_content`, `the_excerpt`, `widget_text_content`, `get_avatar` and `wp_get_attachment_image`

Behavior

### Adds `fetchpriority="high"` to the image most likely to be the LCP image

Since

6.3

Detail from the docs

An image must be at least 50,000 pixels in width times height by default

Behavior

### Omits `loading` for early images

Since

6.3 changed the default

Detail from the docs

The threshold of first content media elements not lazy-loaded went from 1 to 3

Behavior

### Adds `decoding="async"` to images

Since

documented in the function reference

Detail from the docs

Unless the image already has a conflicting `decoding` attribute

**Never both on one image**WordPress says the function never returns both `fetchpriority="high"` and `loading="lazy"` for the same image, because lazy-loading an image while also marking it high priority is an anti-pattern. It also triggers a warning if you supply both yourself.

_02_Explained

## Why the LCP image must not be lazy

web.dev's caution is direct: don't lazy-load images that are likely to be in the viewport when the page loads, especially LCP images. The browser cannot lazy-load an image until it knows where the image sits on the page, which makes those images [load more](/glossary/infinite-scroll) slowly. web.dev also says `loading="eager"` does not load an image faster than one with no attribute. To raise priority, use `fetchpriority="high"`.

web.dev adds that an image with `loading="lazy"` and `fetchpriority="high"` is still delayed while it is off-screen, and that the combination isn't really necessary. WordPress core is built around the same rule, which is why it detects in-viewport images and drops the lazy attribute from them. Read more in [lazy loading](/glossary/lazy-loading) and [lazy-loaded LCP image](/seo-issues/lazy-loaded-lcp-image).

_03_Fix it on your stack

## Override it where core guesses wrong

Core never overrides an attribute that is already there. If you set `loading` or `fetchpriority` before the function runs, WordPress keeps your value. Start with the narrowest tool.

One image from wp_get_attachment_image(): omit the attribute
One image from wp_get_attachment_image(): omit the attribute

```
echo wp_get_attachment_image( 42, 'large', false, array( 'loading' => false ), );
```

Turn lazy loading off for template images (wp_get_attachment_image context)
Turn lazy loading off for template images (wp_get_attachment_image context)

```
function disable_template_image_lazy_loading( $default, $tag_name, $context ) { if ( 'img' === $tag_name && 'wp_get_attachment_image' === $context ) { return false; } return $default; } add_filter( 'wp_lazy_loading_enabled', 'disable_template_image_lazy_loading', 10, 3 );
```

Let a small LCP image be eligible for fetchpriority high
Let a small LCP image be eligible for fetchpriority high

```
add_filter( 'wp_min_priority_img_pixels', function( $size ) { if ( is_this_the_url_with_the_image() ) { return 200 * 200; // Images at least as big as 200x200 } return $size; } );
```

WordPress recommends passing `false` rather than `"eager"` to the `wp_img_tag_add_loading_attr` filter when you want to disable lazy loading for a content image, so the attribute is omitted altogether. For theme templates, the 5.5 dev note says an image in `header.php` that is very likely in the [initial viewport](/glossary/above-the-fold) should skip the loading attribute. The `is_this_the_url_with_the_image()` call in the size-threshold [snippet](/glossary/snippet) is the dev note's own placeholder, so replace it with your own check.

_04_Worth knowing

## Gotchas

### No dimensions, no lazy attribute

WordPress only adds `loading="lazy"` when both `width` and `height` are present. Images pasted as raw HTML or output by a plugin without dimensions can be loaded eagerly, and web.dev says missing dimensions default to 0 by 0 pixels, which can make a gallery load everything at once.

### Back-filling needs the class

Width and height are only added for attachments whose `img` tag has the `wp-image-$id` class.

### Plugins can change the result

The `pre_wp_get_loading_optimization_attributes` and `wp_get_loading_optimization_attributes` filters can alter or short-circuit the output, so a lazy-loading or optimization plugin may disagree with core.

### The first three are free

With the 6.3 default threshold of 3, the first content media elements are not lazy-loaded. A hero image placed after several other images can still get `loading="lazy"`.

### A browser that doesn't support `loading` ignores it

The 5.5 dev note calls the native attribute a progressive enhancement, and web.dev says unsupported browsers see no negative effect.

_05_How it works

## Check it worked

1. 1

### List the attributes

Run `curl -s https://example.com/ | grep -o '<img[^>]*>'` and look at the first large image. It should have no `loading="lazy"`, and should carry `fetchpriority="high"` if WordPress picked it as the LCP image.
2. 2

### Check an image below the fold

A later image should have `loading="lazy"` plus `width` and `height`. If it has neither, the [markup](/glossary/structured-data) was likely not output through core.
3. 3

### Watch the network

In browser DevTools, open the Network tab, filter by Img, and reload without scrolling. Images far below the fold should not load until you scroll near them.
4. 4

### Try both templates

Test a post, the home page and an archive. Core counts images per response, so each template can pick a different first image.

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ Does WordPress lazy load images by default?

Yes. Since 5.5 it adds `loading="lazy"` to `img` tags with width and height attributes, in post content, excerpts, text widgets, avatars and `wp_get_attachment_image()` output.

_02_ How do I disable lazy loading on one WordPress image?

For `wp_get_attachment_image()`, pass `array( 'loading' => false )` as the attributes. For content images, return `false` from the `wp_img_tag_add_loading_attr` filter so the attribute is omitted.

_03_ Does WordPress set fetchpriority high automatically?

Since 6.3 it adds `fetchpriority="high"` to the image it determines is most likely the LCP image. By default an image must be at least 50,000 pixels in width times height to qualify.

Sources · 4

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- wordpress.org
- web.dev

1. 01 [Lazy-loading images in 5.5 | Make WordPress Core](https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/) make.wordpress.org · checked 2026-11-01
2. 02 [Image performance enhancements in WordPress 6.3 | Make WordPress Core](https://make.wordpress.org/core/2023/07/13/image-performance-enhancements-in-wordpress-6-3/) make.wordpress.org · checked 2026-11-01
3. 03 [wp_get_loading_optimization_attributes() | WordPress Developer Resources](https://developer.wordpress.org/reference/functions/wp_get_loading_optimization_attributes/) developer.wordpress.org · checked 2026-11-01
4. 04 [Browser-level image lazy loading for the web | web.dev](https://web.dev/articles/browser-level-image-lazy-loading) web.dev · checked 2026-11-01

## Keep learning

[All platform guides](/seo)

[Learn WordPress Core Web Vitals CMS](/seo/wordpress/core-web-vitals) [Related LCP image is lazy-loaded Performance](/seo-issues/lazy-loaded-lcp-image) [Read next WordPress speed optimization CMS](/seo/wordpress/page-speed) [Do Run a free site audit Free, about two minutes](/site-audit)

More in WordPress SEO
[AMP on WordPress](/seo/wordpress/amp) [Google Analytics on WordPress](/seo/wordpress/google-analytics) [How to put WordPress in maintenance mode](/seo/wordpress/maintenance-mode) [WordPress 404 page](/seo/wordpress/404) [WordPress AI crawlers](/seo/wordpress/ai-crawlers) [WordPress breadcrumbs](/seo/wordpress/breadcrumbs) [WordPress canonical tags](/seo/wordpress/canonical-tags) [WordPress Core Web Vitals](/seo/wordpress/core-web-vitals) [WordPress favicon](/seo/wordpress/favicon) [WordPress Google Search Console setup](/seo/wordpress/search-console) [WordPress hreflang and multilingual SEO](/seo/wordpress/hreflang) [WordPress HTTPS](/seo/wordpress/ssl) [WordPress image SEO](/seo/wordpress/image-seo) [WordPress internal links](/seo/wordpress/internal-links) [WordPress lazy loading](/seo/wordpress/lazy-loading) [WordPress noindex](/seo/wordpress/noindex) [WordPress redirects](/seo/wordpress/redirects) [WordPress robots.txt](/seo/wordpress/robots-txt) [WordPress SEO plugins](/seo/wordpress/seo-plugin) [WordPress SEO titles and meta descriptions](/seo/wordpress/title-and-meta) [WordPress speed optimization](/seo/wordpress/page-speed) [WordPress structured data](/seo/wordpress/structured-data) [WordPress www redirect](/seo/wordpress/www-redirect) [WordPress XML sitemap](/seo/wordpress/xml-sitemap)

Terms on this page
[Infinite scroll](/glossary/infinite-scroll) [Lazy loading](/glossary/lazy-loading) [Above the fold](/glossary/above-the-fold) [Search snippet](/glossary/snippet) [Structured data](/glossary/structured-data)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
