Skip to content

Commit

Permalink
Jetpack_PostImages::from_attachment: Prevent warning when $thumb_post…
Browse files Browse the repository at this point in the history
…_data cannot be found (#35264)
  • Loading branch information
mreishus committed Jan 26, 2024
1 parent 18e6d15 commit 99ea66d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/update-post-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Jetpack_PostImages::from_attachment: Prevent warning when $thumb_post_data cannot be found
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/class.jetpack-post-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99ea66d

Please sign in to comment.