Make WordPress Core


Ignore:
Timestamp:
10/07/2019 03:28:29 PM (7 years ago)
Author:
azaozz
Message:

Upload: Set custom header with the attachment ID for all uploads from media_handle_upload(). Let the REST API endpoint set it separately.

Props timothyblynjacobs.
Fixes #48200.

File:
1 edited

Legend:

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

    r46398 r46421  
    253253                }
    254254
    255                 // Set a custom header with the attachment_id.
    256                 // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
    257                 if ( ! headers_sent() ) {
    258                         header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
    259                 }
    260 
    261255                // Resize the image
    262256                $resized = $editor->resize( $threshold, $threshold );
     
    297291                        // This image cannot be edited.
    298292                        return $image_meta;
    299                 }
    300 
    301                 if ( ! headers_sent() ) {
    302                         header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
    303293                }
    304294
     
    400390                // The image cannot be edited.
    401391                return $image_meta;
    402         }
    403 
    404         // Set a custom header with the attachment_id.
    405         // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
    406         if ( ! headers_sent() ) {
    407                 header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
    408392        }
    409393
Note: See TracChangeset for help on using the changeset viewer.