From d218e9c4b6a99f94ec6d8d73308d01ded8764536 Mon Sep 17 00:00:00 2001 From: COQUARD Cyrille Date: Wed, 22 Nov 2023 12:05:16 +0100 Subject: [PATCH] Added a fix for the lightbox by not passing the wp attributes to the picture tag --- classes/Webp/Picture/Display.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/Webp/Picture/Display.php b/classes/Webp/Picture/Display.php index 7a475327a..639220774 100644 --- a/classes/Webp/Picture/Display.php +++ b/classes/Webp/Picture/Display.php @@ -229,7 +229,11 @@ protected function build_picture_tag( $image ) { unset( $attributes['data-object-position'] ); } - $output = 'build_attributes( $attributes ) . ">\n"; + $picture_attributes = array_filter( $attributes, function ( $attribute ) { + return strpos( $attribute, 'data-wp' ) === false; + }, ARRAY_FILTER_USE_KEY ); + + $output = 'build_attributes( $picture_attributes ) . ">\n"; /** * Allow to add more tags to the tag. *