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
This commit is contained in:
Gary Pendergast 2019-01-17 06:27:50 +00:00
parent e933db7053
commit 3f847f8b6c
2 changed files with 2 additions and 2 deletions

View File

@ -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 ) );
}

View File

@ -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.