From 60350498904ad7688928db07bc6fbc2ea3fda02a Mon Sep 17 00:00:00 2001 From: Debarghya Banerjee Date: Thu, 31 Oct 2024 02:59:58 +0530 Subject: [PATCH] Add check for file key in before using it --- src/wp-includes/media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index b47730e28a39e..920189e6947e2 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1756,7 +1756,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) { } // Bail early if an image has been inserted and later edited. - if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) + if ( isset( $image_meta['file'] ) && preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) && ! str_contains( wp_basename( $image_src ), $img_edit_hash[0] ) ) { return $image;