Make WordPress Core

Ticket #50711: 50711.diff

File 50711.diff, 874 bytes (added by azaozz, 5 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

     
    581581                        update_post_meta( $new_attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
    582582                }
    583583
     584                if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
     585                        // Set a custom header with the attachment_id.
     586                        // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
     587                        header( 'X-WP-Upload-Attachment-ID: ' . $new_attachment_id );
     588                }
     589
    584590                // Generate image sub-sizes and meta.
    585591                $new_image_meta = wp_generate_attachment_metadata( $new_attachment_id, $saved['path'] );
    586592