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:
parent
e933db7053
commit
3f847f8b6c
|
@ -467,7 +467,7 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
|
||||||
unset( $attachment['ID'] );
|
unset( $attachment['ID'] );
|
||||||
|
|
||||||
// Save the attachment metadata
|
// 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 ) ) {
|
if ( ! is_wp_error( $id ) ) {
|
||||||
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
|
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue