For me not working, don’t know if is because working on staging server. For now using conditions to check if webp image available to add on the website.
<?php
$gallery = get_field('gallery');
if($gallery):
?>
<div class="include-slider">
<?php foreach((array) $gallery as $package_slider):
$package_actual_image_attributes = wp_get_attachment_image_src($package_slider, 'testimonial-thumb');
$package_slider_image_alt = get_post_meta($package_slider, '_wp_attachment_image_alt', true);
if (!$package_image_alt) {
$package_image_alt = get_the_title($package_slider);
}
?>
<div class="slider-item">
<?php if(@getimagesize(($package_actual_image_attributes[0] . '.webp'))): ?>
<img src="<?php echo $package_actual_image_attributes[0] . '.webp'; ?>" alt="<?php echo $package_slider_image_alt; ?>" width="<?php echo $package_actual_image_attributes[1]; ?>" height="<?php echo $package_actual_image_attributes[2]; ?>">
<?php else: ?>
<?php echo wp_get_attachment_image($package_slider, 'testimonial-thumb'); ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
Have the same issue. Using siteground server & their webp service. For post thumbnails(<?php the_post_thumbnail('size'); ?>
) webp images are lading on the website but for ACF gallery field(using foreach loop and ID) still loading the old jpg/png images.