From 7d4e730d83712655910feee3344acafe6cee8237 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Fri, 14 Jun 2024 22:26:07 +0530 Subject: [PATCH] Update in logic --- safe-svg.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/safe-svg.php b/safe-svg.php index b43e990b..3dd2dbdf 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -698,11 +698,7 @@ protected function svg_dimensions( $attachment_id ) { * @param int $attachment_id The image attachment ID. */ public function disable_srcset( $image_meta, $size_array, $image_src, $attachment_id ) { - if ( $attachment_id && 'image/svg+xml' === get_post_mime_type( $attachment_id ) ) { - // Convert to array if not already to avoid PHP warnings. - if ( ! is_array( $image_meta ) ) { - $image_meta = array(); - } + if ( $attachment_id && 'image/svg+xml' === get_post_mime_type( $attachment_id ) && is_array( $image_meta ) ) { $image_meta['sizes'] = array(); }