From 3f847f8b6c98c6519a5953de6e5cff3fa6b77603 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 17 Jan 2019 06:27:50 +0000 Subject: [PATCH] Media: `media_handle_sideload()` expectes `wp_insert_attachment()` to return a `WP_Error`. For `wp_insert_attachment()` to do that, we need to be setting the `$wp_error` parameter to true. Props subrataemfluence, jirihon. Fixes #44303. Built from https://develop.svn.wordpress.org/trunk@44634 git-svn-id: http://core.svn.wordpress.org/trunk@44465 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 10d7f3bffe..2738a2137b 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -467,7 +467,7 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data unset( $attachment['ID'] ); // Save the attachment metadata - $id = wp_insert_attachment( $attachment, $file, $post_id ); + $id = wp_insert_attachment( $attachment, $file, $post_id, true ); if ( ! is_wp_error( $id ) ) { wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index aabf59850c..3d9c868d9b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44633'; +$wp_version = '5.1-beta1-44634'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.