Filter to exclude images from lazy load
-
Hi, I see your filter:
add_filter( 'sgo_lazy_load_exclude_images', 'exclude_images_from_lazy_load ); function exclude_images_from_lazy_load( $excluded_images ) { // Add the src url of the image that you want to exclude from using lazy load. $excluded_images[] = 'https://mydomain.com/wp-content/uploads/your-image.jpeg'; return $excluded_images; }
And my question is if “your-image.jpeg” will affect your webP version of that image, so if you serve the webP version of that .jpg, will this filter be applied? Or Do I need to also add another filter for the webP version?
And the same question for all the image sizes that WP creates, for example, “your-image-150×150.jpg” or “your-image-768×253.jpg”.
And Can I add several images to that code? Or Do I need to repeat the code for every image? If I can use the same for several images, Can you write the code for 2-3 images? Must they be separated by a comma or how? For example, Is this correct?:
$excluded_images[] = 'https://mydomain.com/wp-content/uploads/your-image.jpeg, https://mydomain.com/wp-content/uploads/your-image2.jpeg';
Regards.
- The topic ‘Filter to exclude images from lazy load’ is closed to new replies.