WordPress filter hook · part of WordPress core
wp_lazy_loading_enabled
A WordPress core filter that 9 plugins also fire themselves, running on 263K+ sites between them.
How to use wp_lazy_loading_enabled
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'wp_lazy_loading_enabled', function( $default, $tag_name, $context ) {
// Change $default here.
return $default;
}, 10, 3 );Argument names come from Aruba HiSpeed Cache's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
9 plugins that fire wp_lazy_loading_enabled
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Aruba HiSpeed Cache100,000+ installs
apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context )src/AHSC_Lazyload.php:53 -
Strong Testimonials80,000+ installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'strong_testimonials_has_lazyload' )includes/class-strong-view-display.php:566 -
Super Page Cache70,000+ installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'spc_default_native_lazyloading' )src/Modules/Settings_Manager.php:774 -
WP Compress9,000+ installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'wpc_loading_fill' )classes/lazy_verdict.class.php:821 -
Cloudinary4,000+ installs
apply_filters( 'wp_lazy_loading_enabled', true )php/media/class-filter.php:351 -
WebDiagnosis Site Audit10+ installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', '' )includes/class-collector.php:325 -
Convert AVIF, WebP & optimize images10+ installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', 'piowp_default_native_lazyloading' )src/Modules/Settings_Manager.php:470 -
Ulasaslan Site ScannerFewer than 10 installs
apply_filters( 'wp_lazy_loading_enabled', true )includes/class-ussc-image-analyzer.php:49 -
WebPayeshFewer than 10 installs
apply_filters( 'wp_lazy_loading_enabled', true, 'img', null )includes/class-performance.php:1344
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.