Skip to content

Commit bd378ad

Browse files
committed
Media: Avoid warning for undefined 'file' key with image meta array in wp_image_add_srcset_and_sizes().
Follow-up to [35412]. Props debarghyabanerjee, sabernhardt, shanemac10, leedxw, MadtownLems, enravo, djsuperfive, westonruter. See #34430. Fixes #60480. git-svn-id: https://develop.svn.wordpress.org/trunk@61501 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0586dd2 commit bd378ad

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/wp-includes/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
17851785
}
17861786

17871787
// Bail early if an image has been inserted and later edited.
1788-
if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash )
1788+
if ( isset( $image_meta['file'] ) && preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash )
17891789
&& ! str_contains( wp_basename( $image_src ), $img_edit_hash[0] )
17901790
) {
17911791
return $image;

0 commit comments

Comments
 (0)