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

To disable WordPress core’s lazy-loading behavior site-wide, add a callback to the wp_lazy_loading_enabled filter that returns false. If only one image—such as a hero image—needs different treatment, use a scoped or per-image control instead. A narrow change avoids turning off core lazy loading for unrelated images.

Choose the right scope

WordPress offers controls for both broad and selective changes. Pick the narrowest scope that solves the problem: a global callback affects core-supported output wherever the filter applies, while a context-aware callback or image-specific setting changes less.

Need Mechanism Scope
Disable core lazy-loading attributes broadly wp_lazy_loading_enabled filter returning false Supported tags and contexts affected by the callback
Disable it for a tag or context Callback checks the tag name and context before returning false The selected tag or context
Omit the attribute from selected content images wp_img_tag_add_loading_attr filter returning false for matching markup Images in the filter’s supported content path; review version and current API details
Omit it on an image generated from an attachment Pass 'loading' => false to wp_get_attachment_image() That generated image

Disable WordPress core lazy loading site-wide

Add this snippet to a site-specific plugin or a child theme’s functions.php file:

add_filter( 'wp_lazy_loading_enabled', '__return_false' );

The hook is documented as introduced in WordPress 5.5.0. It controls whether core adds a loading attribute for the specified tag and context; returning false disables that behavior broadly. See the WordPress wp_lazy_loading_enabled reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
wordpress hosting
  • easy to use
  • Free app
  • Compatible with all devices
  • It gives the best comparison between ten different hosts

A site-specific plugin keeps the change separate from the theme. If you use a child theme, the code remains separate from the parent theme’s files. Avoid putting a persistent change in a parent theme that may be replaced during an update.

Turn it off only for a tag or context

The filter callback receives the default enabled value, a tag name, and a context. Use those arguments to return false only where needed and leave the existing value unchanged elsewhere:

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

    return $default;
}, 10, 3 );

This example targets image tags in the_content; it does not disable the behavior in every context. Replace the condition with the tag or context you actually want to target, using the hook reference for the filter’s arguments and supported behavior.

Change one image instead of the whole site

For an attachment image

If your theme or plugin creates the image with wp_get_attachment_image(), pass the loading attribute as false:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
echo wp_get_attachment_image( $attachment_id, 'full', false, array(
    'loading' => false,
) );

This omits the attribute for that generated image. The WordPress wp_get_attachment_image() reference documents the function and its image attributes.

For an image in content markup

WordPress documents the wp_img_tag_add_loading_attr filter for changing the attribute on image markup in its supported content path. A callback can inspect the markup and return false for a match; WordPress documents that returning false or an empty string does not add the attribute. Consult the hook reference before using an older example: the related wp_img_tag_add_loading_attr() function is marked deprecated since WordPress 6.3.0, and the optimization-attributes API is the newer implementation path.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why you might disable it—and what the change affects

A common reason is to avoid lazy loading on an image that should appear immediately, such as a hero image near the top of a page. That does not necessarily justify removing lazy loading from every other image. WordPress’s core documentation describes behavior in contexts including post content (the_content), excerpts (the_excerpt), text widgets (widget_text_content), avatars (get_avatar), and template images produced through wp_get_attachment_image(). The exact output can depend on context and image position. See the WordPress documentation on working with images.

WordPress recommends omitting the loading attribute by returning false rather than setting loading="eager" merely to counteract lazy loading. These controls govern WordPress core behavior; they do not establish what a theme, optimization plugin, CDN, or hosting platform may add independently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
WordPress Hosting Guide
  • Free WordPress Hosting Guide Android Application. It Contains: A Brief Overview of WordPress Hosting, 9 Major Benefits of Managed WordPress Hosting.
  • 5 Simple Steps to Choose WordPress Hosting, How to Maximize Your WordPress Hosting and Blogging Success, How to Choose the Best WordPress Hosting Provider, Optimize Your Blog with VIP Word.
  • Press Hosting, What You Should Know to Choose the Best WordPress Hosting and Much More.

Verify the rendered page

  1. Apply the filter or image-specific setting in the component that produces the markup.
  2. Load the affected page and inspect its final HTML, not just the PHP template. Find the relevant <img> tags and check whether they still contain loading="lazy".
  3. If the attribute remains, identify the markup path that created the image and check whether a theme, optimization plugin, or custom code modifies it after WordPress core runs.
  4. For a selective rule, inspect both the target image and images outside the target context to confirm the rest of the page retains its intended behavior.

Because third-party behavior varies, a core filter alone cannot guarantee that every plugin or platform will stop adding lazy-loading behavior.

Quick Recap

Bestseller No. 1
wordpress hosting
wordpress hosting
easy to use; Free app; Compatible with all devices; It gives the best comparison between ten different hosts
Bestseller No. 5
WordPress Hosting Guide
WordPress Hosting Guide
Press Hosting, What You Should Know to Choose the Best WordPress Hosting and Much More.

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.