diff --git a/projects/plugins/jetpack/changelog/update-post-images b/projects/plugins/jetpack/changelog/update-post-images new file mode 100644 index 0000000000000..a7d05e6e04088 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-post-images @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Jetpack_PostImages::from_attachment: Prevent warning when $thumb_post_data cannot be found diff --git a/projects/plugins/jetpack/class.jetpack-post-images.php b/projects/plugins/jetpack/class.jetpack-post-images.php index fad3418323fd9..239344a9df22c 100644 --- a/projects/plugins/jetpack/class.jetpack-post-images.php +++ b/projects/plugins/jetpack/class.jetpack-post-images.php @@ -339,7 +339,7 @@ public static function from_thumbnail( $post_id, $width = 200, $height = 200 ) { // If wp_get_attachment_image_src returns false but we know that there should be an image that could be used. // we try a bit harder and user the data that we have. $thumb_post_data = get_post( $thumb ); - $img_src = array( $thumb_post_data->guid, $meta['width'], $meta['height'] ); + $img_src = array( $thumb_post_data->guid ?? null, $meta['width'], $meta['height'] ); } // Let's try to use the postmeta if we can, since it seems to be