From a30bccb7bf15c6a2046707573ce22345e3bb81dd Mon Sep 17 00:00:00 2001 From: Adam Cassis Date: Wed, 20 Aug 2025 11:24:02 +0200 Subject: [PATCH] fix(woocommerce): image handling in paginated block --- includes/plugins/class-perfmatters.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/plugins/class-perfmatters.php b/includes/plugins/class-perfmatters.php index b06a5daf5c..d901c8db0f 100644 --- a/includes/plugins/class-perfmatters.php +++ b/includes/plugins/class-perfmatters.php @@ -223,11 +223,22 @@ private static function get_defaults( $options = [] ) { $options['lazyload']['youtube_preview_thumbnails'] = true; $options['lazyload']['image_dimensions'] = true; - $parent_exclusions = empty( $options['lazyload']['lazy_loading_parent_exclusions'] ) ? [] : $options['lazyload']['lazy_loading_parent_exclusions']; // Add our customizations to the front of the array to avoid confusion when editing the setting in the UI. - $options['lazyload']['lazy_loading_parent_exclusions'] = array_merge( - [ 'wp-block-jetpack-image-compare' ], - $parent_exclusions + $lazy_loading_exclusions = empty( $options['lazyload']['lazy_loading_exclusions'] ) ? [] : $options['lazyload']['lazy_loading_exclusions']; + $options['lazyload']['lazy_loading_exclusions'] = array_unique( + array_merge( + [ + 'attachment-woocommerce_thumbnail', // If WC product images are within a pagination, the pages loaded after pageload will not not have images handled otherwise. + ], + $lazy_loading_exclusions + ) + ); + $parent_exclusions = empty( $options['lazyload']['lazy_loading_parent_exclusions'] ) ? [] : $options['lazyload']['lazy_loading_parent_exclusions']; + $options['lazyload']['lazy_loading_parent_exclusions'] = array_unique( + array_merge( + [ 'wp-block-jetpack-image-compare' ], + $parent_exclusions + ) ); // Fonts.