swift_performance_lazyload_image_args

Filter for the arguments for an image which will be lazyloaded.

Parameters

$args

array, contains all attributes for the <img> tag

$id

id of the image. It will represent the attachment id if the image is in the media library, 0 otherwise.


Return

array


Example

// Remove srcset for logo
add_filter('swift_performance_lazyload_image_args', function($attr, $id){
 if ($id == 100){ // 100 is the id of the logo in this example
  unset($attr['srcset']);
 }
 return $attr;
}, 10, 2);