WordPress Lazy Loading: What It Is and How to Enable It

You've probably heard that lazy loading makes WordPress sites faster. It's one of those performance techniques that sounds technical but is actually easy to understand and even easier to implement.

In this guide, we'll explain exactly what lazy loading is, how it works in WordPress, why it significantly improves page load times, how to enable and configure it correctly — and one critical mistake that almost everyone makes that actually makes their site slower.

What Is Lazy Loading?

Lazy loading is a web performance technique that defers the loading of off-screen content until it's actually needed — specifically, until the user scrolls near it.

Without lazy loading: When a visitor opens your page, the browser immediately downloads every single image, video, and iframe on the page — including ones at the very bottom that the visitor may never scroll to. All of this downloading happens before the page feels interactive to the user.

With lazy loading: The browser only loads images and videos that are currently visible (or close to visible) in the viewport. As the user scrolls down, additional images load just in time — transparently, without the user noticing any delay.

The result: Your page's initial load is dramatically faster because the browser only has to download a fraction of the total media on the page before showing content to the user.

A concrete example

Imagine a WordPress blog post with 15 images. Without lazy loading, all 15 images download when the page loads — even though the visitor only sees the first 2 images above the fold. That might be 8MB of image data downloaded before the visitor reads a single word.

With lazy loading, only the first 2–3 visible images load immediately. The remaining 12 images download only as the user scrolls towards them. Initial page load might involve just 1.5MB of image data instead of 8MB — a massive speed improvement.

How Lazy Loading Works in WordPress

WordPress implements lazy loading via the HTML loading attribute on <img> tags:

HTML
<img src="image.jpg" loading="lazy" width="800" height="500" alt="Description">

When a browser sees loading="lazy", it knows not to download the image until it enters (or is close to entering) the visible viewport.

Browser support: The loading="lazy" attribute is supported by all modern browsers — Chrome, Firefox, Safari (15.4+), Edge, and Opera. It's a native HTML feature, not a JavaScript hack, which makes it lightweight and reliable.

For browsers that don't support it (very old browsers), the attribute is simply ignored and images load normally — it degrades gracefully with no negative consequences.

WordPress Built-In Lazy Loading (Since Version 5.5)

WordPress added native lazy loading support in version 5.5 (released August 2020). Since then, WordPress automatically adds loading="lazy" to:

  • Images inserted through the block editor (Gutenberg)
  • Images in the Classic Editor
  • Featured images output by your theme using the_post_thumbnail()
  • Images added via wp_get_attachment_image()
  • Avatar images
This means if you're running WordPress 5.5 or later, lazy loading is already active on most of your images — with no plugin required.

How to verify it's working:

  1. Open any page on your WordPress site in Chrome
  2. Right-click on an image that's below the fold
  3. Select Inspect
  4. In the Elements panel, find the <img> tag
  5. Look for loading="lazy" in the attributes

If you see it, native lazy loading is active. If you don't see it on images that should have it, your theme may be outputting image HTML directly (bypassing WordPress's image functions) or an older plugin may be overriding the attribute.

The Critical Mistake: Never Lazy Load Your Hero Image

This is the most important thing in this entire guide. Read it carefully.

Never apply lazy loading to your above-the-fold hero image.

Your LCP (Largest Contentful Paint) — one of Google's three Core Web Vitals ranking signals — is measured as the time it takes for the largest visible element above the fold to fully appear on screen. For most WordPress sites, this is the hero image at the top of the page.

If your hero image has loading="lazy", the browser intentionally delays loading it. The browser waits to see if you'll scroll first before downloading the image. This directly delays your LCP — hurting your Core Web Vitals score and your Google ranking.

The correct approach:

  • Hero image, main above-fold image: loading="eager" (or no loading attribute at all — eager is the default)
  • All images below the fold: loading="lazy"

How WordPress handles this:

Since WordPress 5.9, WordPress is smart about this. It automatically skips adding loading="lazy" to the first image in the content on most themes — applying loading="eager" instead. However, this logic depends on your theme correctly using WordPress's image output functions.

To verify your hero image is loading correctly:

  1. Inspect your hero image in developer tools
  2. Check for loading="lazy" — if you see it, that's a problem
  3. Also run Google PageSpeed Insights — it will specifically flag "Largest Contentful Paint element" and whether lazy loading is incorrectly applied to it

If your hero image is incorrectly lazy loaded, add this to your theme's functions.php to force eager loading on the first image:

PHP
add_filter( 'wp_lazy_loading_enabled', function( $default, $tag_name, $context ) {
    if ( 'the_content' === $context ) {
        return $default;
    }
    return $default;
}, 10, 3 );

For theme-specific hero images, ensure the get_header_image_tag() or custom hero image output doesn't include loading="lazy".

How to Enable Additional Lazy Loading in WordPress

While WordPress handles image lazy loading natively, there are other types of content that benefit from lazy loading — iframes, videos, comments, and widgets — that WordPress doesn't handle automatically.

01
Lazy Load iframes and Videos

YouTube embeds, Vimeo videos, Google Maps, and other iframes are often the heaviest elements on a page. A single YouTube embed loads several hundred kilobytes of JavaScript before the user even clicks play.

Method 1: Native iframe lazy loading

Modern browsers support loading="lazy" on iframes too. The block editor's embed blocks and some plugins add this automatically. Check by inspecting any embed element.

Method 2: Facade / click-to-load (better for performance)

Instead of loading the full embed on page load, display a preview image. The full embed only loads when the user clicks play. This is even more effective than standard lazy loading.

Install WP YouTube Lyte or use WP Rocket's "Replace YouTube iframes with a preview image" feature to implement facade loading for YouTube embeds.

02
Lazy Load with WP Rocket

WP Rocket extends lazy loading significantly:

  1. Go to WP Rocket → Media
  2. Enable "LazyLoad" for images
  3. Enable "LazyLoad" for iframes and videos
  4. Enable "Replace YouTube iframes with preview image"
  5. Optionally enable lazy loading for CSS background images
WP Rocket's lazy loading implementation is one of the most comprehensive available — including background images in CSS, which no native browser implementation handles.
03
Lazy Load with LiteSpeed Cache

LiteSpeed Cache includes excellent lazy loading:

  1. Go to LiteSpeed Cache → Page Optimization
  2. Click the Media tab
  3. Enable "Lazy Load Images"
  4. Enable "LazyLoad Iframes"
  5. Configure the "Responsive Placeholder" to avoid layout shifts
04
Lazy Load with a Dedicated Plugin

If you're not using WP Rocket or LiteSpeed Cache, a3 Lazy Load (free) is a well-maintained dedicated lazy loading plugin:

  1. Install and activate from Plugins → Add New
  2. Go to Settings → a3 Lazy Load
  3. Enable lazy loading for images, iframes, and videos
  4. Configure threshold (how many pixels before the viewport to start loading — 200px is a good default)
  5. Set placeholder style (transparent, spinner, or blur effect)
05
Advanced: Lazy Loading CSS Background Images

CSS background images (set via background-image: url(...) in stylesheets) aren't handled by the native loading="lazy" attribute — that only works for <img> tags. Background images load immediately regardless of where they are on the page.

This matters for pages with hero sections using CSS backgrounds, section dividers with background images, and parallax effects.

Solutions:

  • WP Rocket — Includes a "Lazy Load CSS background images" feature in its Media settings
  • LiteSpeed Cache — Handles CSS background lazy loading via its page optimization settings
  • Manual implementation — Requires custom JavaScript to detect viewport visibility and swap a placeholder for the real background image URL — not practical without developer help
06
Lazy Loading for WooCommerce Product Images

WooCommerce product galleries, shop archive pages, and related products sections often contain dozens of product images. Lazy loading is especially valuable here.

For WooCommerce:

  • Product images on shop/archive pages are output by WooCommerce's template functions — most properly support loading="lazy" in recent versions
  • Gallery images within product pages should also be lazy loaded
  • Related and upsell product images are below the fold and excellent candidates for lazy loading

If product images aren't lazy loading, check:

  1. Your WooCommerce version (update if outdated)
  2. Your theme — some themes output product images using non-standard code that bypasses WordPress's lazy loading
  3. Any WooCommerce gallery plugins that might override image output

Measuring the Impact of Lazy Loading

After enabling lazy loading, measure your improvement:

Google PageSpeed Insights:

  • Check your LCP score — should improve if previously off-screen images were loading early
  • Look for "Defer offscreen images" in the Opportunities section — this warning should disappear after enabling lazy loading

GTmetrix:

  • Total page size should decrease for the initial load
  • Waterfall chart should show fewer images loading in the first few seconds
Core Web Vitals real-world data: After 28 days, your real-world Core Web Vitals data in Google Search Console will reflect the improvement. Go to Search Console → Core Web Vitals to monitor your LCP, FID/INP, and CLS scores over time.

Lazy Loading Quick Reference

Content Type Native Support Plugin Needed Notes
<img> tags in content✅ WordPress 5.5+NoVerify loading="lazy" is present
Featured images✅ WordPress 5.5+NoCheck theme uses standard functions
Hero / above-fold image✅ WordPress 5.9+NoMust NOT be lazy loaded — verify
YouTube / video iframes❌YesUse WP Rocket or a3 Lazy Load
CSS background images❌YesWP Rocket or LiteSpeed Cache
Avatars✅ WordPress 5.5+NoApplied to comment avatars
WooCommerce images✅ Recent WC versionsNoVerify in inspector

Frequently Asked Questions

Q: Does lazy loading work on mobile?

A: Yes. The loading="lazy" attribute is supported by Chrome for Android, Safari on iOS 15.4+, and all other major mobile browsers. In fact, lazy loading is especially impactful on mobile where connections are slower and every byte of initial page weight matters more.

Q: Can lazy loading hurt my SEO?

A: Properly implemented lazy loading improves SEO by improving Core Web Vitals scores. The only way it can hurt SEO is if it's applied to your hero/LCP image, delaying its load. Googlebot also crawls JavaScript-executed lazy loads — but native loading="lazy" images are fully visible to Google's crawlers.

Q: My images are already lazy loading but PageSpeed still shows "Defer offscreen images." Why?

A: This warning often refers to images loaded by JavaScript or CSS background images, which aren't covered by native lazy loading. Check for carousel/slider images, CSS backgrounds, or images loaded by plugins that don't use standard WordPress image functions.

Q: Does lazy loading affect ad revenue?

A: It can, if ads are image-based and users don't scroll to them. For AdSense or display advertising, verify your ad network's documentation on lazy loading compatibility. Most modern ad networks handle this correctly.

Final Thoughts

WordPress lazy loading is one of the most effective, lowest-effort performance improvements available. For most sites running WordPress 5.5 or later, it's already active — but verifying it's configured correctly (especially ensuring your hero image is NOT lazy loaded) is essential.

Extend native lazy loading to iframes and videos using WP Rocket, LiteSpeed Cache, or a dedicated plugin, and you'll see meaningful improvements in both page load time and Core Web Vitals scores.

Need help auditing your WordPress site's lazy loading configuration and Core Web Vitals performance? Our team handles exactly this.

Contact us today
Views: 167