The Lazy Load tab within the “Resource Loading” area from the plugin’s settings, automatically adds loading="lazy" to eligible
<img> tags found in the final HTML output.
This helps reduce the number of images downloaded during the initial page load, which can improve the page load speed, core web vitals, bandwidth usage and overall user experience.
Quick Navigation
- How It Works
- Relationship to “Image Attributes”
- Images Automatically Excluded
- Optional Image Decoding
- Lazy Load Exclusions
- Example Workflow
- Important Notes
- SEO Considerations
- Recommended Default Settings
How It Works
When enabled, Asset CleanUp scans all <img> tags found in the final HTML output
and determines whether each image is safe to lazy load.
Eligible images are updated as follows:
<img src="image.jpg" alt="Example">
becomes:
<img src="image.jpg" alt="Example" loading="lazy">
Relationship to “Image Attributes”
The Image Attributes tab and the Lazy Load tab serve different purposes.
Image Attributes (Granular Control)
Use the Image Attributes tab when you want to explicitly add, replace, or override image attributes such as:
fetchpriorityloadingdecoding
Examples:
- Change
fetchpriority="high"tofetchpriority="auto" - Replace
loading="eager"withloading="lazy" - Change
decoding="sync"todecoding="async"
This feature is rule-based and applies only to images matching specific conditions, such as a source URL containing a specific keyword or matching a regular expression.
Lazy Load (Automatic)
Use the Lazy Load tab when you want Asset CleanUp to automatically add loading="lazy" to images that are considered safe to defer.
It does not override attributes that indicate an image was intentionally marked as critical.
Images Automatically Excluded
Automatic lazy loading skips images that are likely important for above-the-fold rendering.
Images are skipped if they already contain:
fetchpriority="high"loading="eager"
These attributes usually indicate that the image should load immediately.
If these values were added incorrectly by your theme or another plugin, you can override them using the Image Attributes tab.
fetchpriority="high" with fetchpriority="auto", the image becomes eligible for automatic lazy loading.
Optional Image Decoding
Apply decoding="async"
When enabled, Asset CleanUp also adds decoding="async" to automatically lazy-loaded
images, but only if no decoding attribute is already present.
Example:
<img src="photo.jpg">
becomes:
<img src="photo.jpg" loading="lazy" decoding="async">
If the image already contains decoding="sync", decoding="auto", or
decoding="async", the existing value is preserved.
Lazy Load Exclusions
You can exclude images from automatic lazy loading using several criteria.
Skip the First X Eligible Images
Skip the first N eligible images found in the HTML source.
Examples:
0→ Lazy load all eligible images1→ Skip the first eligible image3→ Skip the first three eligible images
This is useful for preserving above-the-fold images.
URL Keywords
Exclude images whose source URL contains specific keywords.
Examples:
/logo /hero banner-
Regular expressions are also supported when wrapped in #, ~, !, or % delimiters.
Example:
#/uploads/.+\.(jpg|webp)$#i
The matching process checks common image-related attributes such as:
srcsrcsetdata-srcdata-srcset
CSS Classes
Exclude images containing specific CSS classes.
Examples:
custom-logo hero-image skip-lazy
Enter one class per line, without the leading dot.
CSS Selectors
Exclude images that match or are located inside specific CSS selectors.
Examples:
.site-header img .hero-section img #featured-image
This option is useful when images do not have unique URLs or CSS classes.
Example Workflow
Suppose your homepage contains:
- Company logo
- Hero image
- Product thumbnails
- Footer images
Recommended setup:
- Skip the first
2eligible images - URL Keywords:
/logo/hero
- CSS Classes:
custom-logo
- Enable
decoding="async"
Result:
- Logo and hero image load immediately
- Product thumbnails and footer images are lazy loaded
Important Notes
- Existing
loading="lazy"attributes are preserved. - Images with
loading="eager"are skipped. - Images with
fetchpriority="high"are skipped. - Existing
decodingattributes are preserved. - Use the Image Attributes tab to explicitly replace or override existing image attributes when needed.
SEO Considerations
When used correctly, automatic image lazy loading is generally safe for SEO.
To avoid delaying critical images:
- Skip above-the-fold images
- Respect
fetchpriority="high" - Respect
loading="eager"
This follows Google’s recommendations for browser-native lazy loading.
Recommended Default Settings
For most websites, the following defaults are recommended:
- Enable automatic image lazy loading
- Enable
decoding="async" - Skip the first
1or2eligible images - Add common exclusions such as:
custom-logo/logo/hero
These defaults provide a good balance between performance and visual stability.