Make WordPress Core

Ticket #44303: 44303.diff

File 44303.diff, 557 bytes (added by subrataemfluence, 6 years ago)

Proposed patch

  • media.php

    diff --git src/wp-admin/includes/media.php b/media.php
    index c941e62..0937a82 100755
    old new function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data 
    465465        unset( $attachment['ID'] );
    466466
    467467        // Save the attachment metadata
    468         $id = wp_insert_attachment( $attachment, $file, $post_id );
     468        $id = wp_insert_attachment( $attachment, $file, $post_id, true );
    469469        if ( ! is_wp_error( $id ) ) {
    470470                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
    471471        }