From 7659f94b477aac669567203b51c1739827e39a2d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 25 Nov 2019 10:07:32 +0000 Subject: [PATCH] Media: Avoid a PHP notice in `image_downsize()` when trying to replace a non-image URL with a rendered image from its meta. Props Mte90, jrf, hareesh-pillai. Merges [46772] to the 5.3 branch. Fixes #48324. git-svn-id: https://develop.svn.wordpress.org/branches/5.3@46773 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 002581e174..3783865958 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -214,7 +214,7 @@ function image_downsize( $id, $size = 'medium' ) { // If the file isn't an image, attempt to replace its URL with a rendered image from its meta. // Otherwise, a non-image type could be returned. if ( ! $is_image ) { - if ( ! empty( $meta['sizes'] ) ) { + if ( ! empty( $meta['sizes']['full'] ) ) { $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); $img_url_basename = $meta['sizes']['full']['file']; $width = $meta['sizes']['full']['width'];