Filter – WordPress wp_lazy_loading_enabled returns loading attribute set to lazy

strange way, add_filter( 'wp_lazy_loading_enabled', '__return_false' ); still returns loading=lazy, To accomplish this, I have to unset instead of this. Is there a reason the filter doesn’t disable it completely?

function disable_lazy_load_featured_images($attr, $attachment = null) {
    unset( $attr['loading'] );
    return $attr;
}
add_filter('wp_get_attachment_image_attributes', 'disable_lazy_load_featured_images');

Leave a Comment