DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk10 min

How to Enable Lazy Loading in WordPress to Speed Up Your Site

WordPress already lazy-loads eligible images and iframes in modern releases. This guide shows how to verify the rendered HTML, keep LCP media eager, prevent layout shifts, customize exceptions with core filters, and troubleshoot themes, embeds, and plugins.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most WordPress sites already have lazy loading enabled. WordPress 5.5 and later automatically add the native loading='lazy' attribute to eligible images, and WordPress 5.7 added the same support for eligible iframes. You normally need to verify the rendered HTML—not turn on another dashboard switch.

The important configuration is deciding what not to defer. Keep a logo, hero image, featured image, or other image visible in the first viewport eager when it is the page’s largest contentful paint (LCP) candidate. Give every deferred image reliable dimensions so the browser can reserve its space, and use a plugin only when you need controls that WordPress core does not provide.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What WordPress lazy-loads automatically

Lazy loading tells the browser to delay fetching media until it is close to the visible part of the page. Below-the-fold images can therefore wait while the browser concentrates on text, stylesheets, scripts, and media the visitor can see immediately. Deferring those early downloads can reduce initial network work, mobile data use, and battery consumption. It is not a guaranteed speed percentage: the result depends on the page, device, network, image sizes, and which element is the LCP candidate.

WordPress uses the browser’s native HTML loading attribute rather than requiring JavaScript for the basic feature. The default behavior has expanded over several releases:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
WordPress release Default behavior What it means for you
5.5 (2020) Eligible images receive native lazy loading. Ordinary images in supported WordPress output generally need no plugin or setting.
5.7 (2021) Eligible iframe elements are included. Many embedded documents and video frames can be deferred when their markup has a source and dimensions.
5.9 (2021) The first content image or iframe is skipped by default. Core makes a reasonable attempt to avoid delaying the first visible media, but custom themes can identify the wrong element.

Core’s lazy-loading logic covers images produced in post content, excerpts, text widgets, avatars, and attachment-image output. It also uses intrinsic dimensions and responsive attributes when WordPress can generate them. Custom markup, page builders, themes, cache layers, and optimization plugins can change the final result, so the browser’s rendered HTML is the authority.

Check your prerequisites before changing anything

Use a current, maintained WordPress installation. Update WordPress, your active theme, and plugins through your normal backup and maintenance process before diagnosing lazy loading. A site running an older release may not have the same image and iframe behavior described here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Confirm the image or iframe is actually output by WordPress or by code that applies the relevant core filters.
  • Make sure media has width and height information. Core can only protect the layout when dimensions are present in the output.
  • Identify the element that paints first in the viewport. It may be a hero image, a featured image, a logo, a background image, or a custom component rather than the first image in the article body.
  • Change one optimization layer at a time. A theme, page builder, cache, CDN, and performance plugin can each rewrite or remove attributes.

How to verify native lazy loading step by step

  1. Update safely. Back up the site, update WordPress and the active theme and plugins, then clear any page and object caches. Test a representative page while logged out so you see the public HTML.
  2. Create or edit a test image. Add it through the Media Library and insert it with the block editor, or use a standard theme function such as wp_get_attachment_image(). WordPress’s native behavior is most predictable when the image is rendered through supported functions.
  3. Inspect the final element. Open the page in a browser, choose Inspect on the image, and look at the actual <img> element. You can also use View Page Source; developer tools show the DOM after scripts and plugins have modified it.
  4. Check the attributes. A typical eligible image should contain loading='lazy', intrinsic width and height, and responsive srcset and sizes when WordPress has suitable image metadata. The exact URLs and source candidates vary with the selected image size and theme.
  5. Inspect the first viewport separately. Scroll position zero is not enough. Determine which image or iframe is the LCP candidate in a performance audit. WordPress 5.9 skips the first content image or iframe by default, but a custom layout can place another element above it.
  6. Run an audit and compare. Test a page with the browser’s performance tools or an audit service before and after a change. Confirm that below-the-fold media is deferred and that the LCP image starts early. Do not judge success from a plugin dashboard toggle alone.

If an image in the source has no loading attribute, that does not automatically mean the browser is broken. It may be an above-the-fold element intentionally left eager, custom markup outside the core path, or markup that another component has rewritten. Inspect its dimensions, rendering context, and the final HTML before adding a plugin.

Keep the hero and LCP image eager

Lazy loading is a below-the-fold optimization. If the browser is told to wait for the image that defines the first-screen experience, the page can look unfinished and the LCP time can increase. Do not lazy-load a logo, hero, featured image, or other immediately visible media unless measurement shows that it is not part of the initial render.

Find the correct image

Use a performance trace to identify the LCP candidate at the viewport and connection conditions you care about. On one template the candidate may be a banner image; on another it may be a product photograph, a featured image, or text. The first image in the article body is not necessarily the LCP image.

Use eager loading for a known content image

For an image generated in post content, the per-tag filter can return eager for the specific hero or false to omit the attribute entirely. The condition should be narrow—based on a known attachment, class, template, or other reliable marker—so that ordinary article images remain lazy-loaded.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
add_filter( 'wp_img_tag_add_loading_attr', function ( $value, $image, $context ) {
    if ( 'the_content' === $context && false !== strpos( $image, 'class="hero-image"' ) ) {
        return 'eager';
    }
    return $value;
}, 10, 3 );

The example returns the existing value for every other content image. Adjust the selector to your own markup; do not copy a class that does not exist in your template. Returning false removes the attribute, while returning eager explicitly tells the browser to fetch promptly.

Pass the value when generating an attachment image

If your theme or plugin calls wp_get_attachment_image() for a hero, pass a loading value in its attributes array. This keeps the exception next to the code that knows the image’s role.

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

Do not combine loading='lazy' with a high-priority instruction for the same image. WordPress’s optimization guidance treats those directions as conflicting: one asks the browser to delay the request while the other asks it to prioritize the request.

Prevent layout shifts with dimensions

When a lazy image has no known dimensions, the browser may allocate little or no space before the file arrives. Content then moves when the image decodes, producing a jump while the visitor scrolls. Width and height attributes let the browser infer the aspect ratio in advance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use WordPress image functions and registered image sizes whenever possible. They normally emit intrinsic dimensions and responsive srcset/sizes data. For custom HTML, include accurate width and height values that match the source’s aspect ratio, then use CSS such as max-width:100%; height:auto; to keep the image responsive. If a crop changes the aspect ratio, use the cropped dimensions rather than the original file’s dimensions.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

The same principle applies to iframes. Supply a source and dimensions so core can attach its loading attribute and the browser can reserve the frame’s space. A responsive wrapper with a stable aspect ratio is preferable to an iframe whose height appears only after a player script runs.

Use core filters for site-wide or template-specific exceptions

Control whether a tag and context are eligible

The wp_lazy_loading_enabled filter receives the default decision, the tag name, and the rendering context. Return false only for the context you truly need to exempt.

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

This example disables core’s automatic decision for every attachment image, which is broader than a single hero exception. Narrow the condition in production—for example, by checking a template or attachment ID—unless you have a deliberate reason to make all output from that context eager.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change a content image one tag at a time

wp_img_tag_add_loading_attr is appropriate when you need to return lazy, eager, or false for an individual content image. Inspect the hook arguments and use stable markers. A string search that matches a generic class or filename can affect unrelated images after a redesign.

Check hook priority and later rewrites

A filter can appear ineffective when another callback runs later, or when a cache stores HTML produced before the change. Inspect the final response, clear all relevant caches, and check callback priority. The last component that edits the attribute determines what the browser receives.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a lazy-loading plugin is justified

Core is sufficient for ordinary images and eligible iframes. A plugin becomes useful when the site needs behavior that native attributes do not express, such as video-element lazy loading, custom viewport thresholds, placeholders, exclusion lists, source restoration, or a no-JavaScript fallback.

Capability WordPress core Plugin-based approach
Images in standard WordPress output Supported automatically from 5.5. Usually unnecessary; may add controls or exclusions.
Iframes Supported by default from 5.7 when source and dimensions are available. Can add specialized handling for custom embeds or player facades.
HTML5 video elements No general native WordPress policy comparable to image output. Useful when the plugin can defer sources, poster files, or player initialization.
Viewport threshold tuning Not exposed as a general site setting. Often available, but test whether an aggressive threshold downloads too much early.
Placeholders and fallbacks Core reserves dimensions but does not provide a full placeholder system. May provide blurred placeholders, source restoration, or no-JavaScript behavior.
Compatibility Part of WordPress and browser standards. Requires testing with the theme, page builder, cache, CDN, and other optimization tools.

Check the plugin’s WordPress-version requirement and its method before activation. For example, the documented Smart LazyLoad listing requires WordPress 5.8 or higher. That requirement is specific to that plugin, not to native lazy loading. Do not install two tools that both rewrite loading, replace image sources, or inject placeholders without testing; they can duplicate JavaScript, undo exclusions, or produce broken markup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Video embeds need a separate decision

An embedded video often uses an iframe, so WordPress’s iframe attribute may defer creation of the frame. That does not guarantee that the player’s scripts, thumbnails, or custom embed code are lightweight. A facade that displays a poster and creates the player only after interaction can reduce work further, but it is a plugin or custom-implementation concern rather than a promise made by core.

Troubleshoot the common failures

No loading='lazy' appears

  • Confirm that the element is an img or iframe produced through a supported WordPress path.
  • Check that width and height are present and that the element is not intentionally the first visible media.
  • Inspect the final response after clearing page, object, CDN, and browser caches.
  • Look for a theme, page builder, optimization plugin, or cache layer that strips or replaces the attribute.
  • Check whether another filter changes the value after your callback.

An absent attribute is not necessarily an error for an eager LCP element. Judge the element’s role and the network waterfall, not just whether every image contains the word lazy.

The hero image loads slowly

Inspect the LCP candidate and its rendered attributes. If it has loading='lazy', exclude it or return eager for that template. If it is already eager, investigate image dimensions, source selection, server response time, and render-blocking resources rather than adding more lazy-loading code. WordPress’s first-content-image exception cannot identify every custom hero layout.

The layout jumps while scrolling

Add accurate width and height attributes, preserve the source aspect ratio, and reserve space for responsive embeds. If a plugin inserts a placeholder, verify that the placeholder and final media use the same dimensions. A lazy attribute alone does not prevent cumulative layout movement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An embedded video is still heavy

Determine whether the page contains a normal iframe, a custom player, or an HTML5 video element. Iframe lazy loading can defer the frame, but a player that preloads scripts or a video element with an eager source may need a specialized facade or plugin. Confirm that any solution still provides keyboard access, controls, captions, and a usable fallback.

A filter has no effect

View the final HTML, not only the PHP callback. Verify the hook name, accepted argument count, callback priority, template condition, and cache state. Then search for another callback that edits the same attribute later. A correct filter attached to a rendering path that your page builder does not use will never run.

A practical configuration checklist

  1. Run a backup and update WordPress, the theme, and plugins.
  2. Confirm that ordinary images contain native lazy attributes, dimensions, and responsive sources where available.
  3. Identify the real LCP element on each important template.
  4. Keep that first-screen image or iframe eager when it is visible immediately.
  5. Use WordPress image functions or add accurate dimensions to custom markup.
  6. Test image and iframe behavior in the rendered source and in developer tools.
  7. Use a narrowly scoped core filter for exceptions instead of disabling lazy loading globally.
  8. Add a plugin only for video handling, thresholds, placeholders, exclusions, source restoration, or fallbacks that core does not provide.
  9. After every change, clear caches and compare the network waterfall and LCP result.

There is no universal performance percentage to promise from lazy loading. The reliable rule is conditional: defer media that is genuinely below the fold, reserve its space, and make the media that paints the first viewport available as early as possible.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.