WordPress.org

Make WordPress Core

Changeset 44634


Ignore:
Timestamp:
01/17/2019 06:26:05 AM (11 months ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r44532 r44634  
    468468
    469469    // Save the attachment metadata
    470     $id = wp_insert_attachment( $attachment, $file, $post_id );
     470    $id = wp_insert_attachment( $attachment, $file, $post_id, true );
    471471    if ( ! is_wp_error( $id ) ) {
    472472        wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
Note: See TracChangeset for help on using the changeset viewer.