[wp-trac] [WordPress Trac] #64010: wp_die() status code Media component updates (parent ticket: #64009)

WordPress Trac noreply at wordpress.org
Tue Oct 7 10:08:43 UTC 2025


#64010: wp_die() status code Media component updates (parent ticket: #64009)
------------------------------------+------------------------------
 Reporter:  callumbw95              |       Owner:  (none)
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Media                   |     Version:  trunk
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by callumbw95):

 Hi @rollybueno,

 Apologies for the delayed response on my part. I have now taken a look
 into your report, and the reason you are still seeing a 500 error here is
 that `media-new.php` form submission is handle by the following code on
 lines 29-40 within the same file:

 {{{#!php
 <?php
 if ( $_POST ) {
         if ( isset( $_POST['html-upload'] ) && ! empty( $_FILES ) ) {
                 check_admin_referer( 'media-form' );
                 // Upload File button was clicked.
                 $upload_id = media_handle_upload( 'async-upload', $post_id
 );
                 if ( is_wp_error( $upload_id ) ) {
                         wp_die( $upload_id );
                 }
         }
         wp_redirect( admin_url( 'upload.php' ) );
         exit;
 }
 }}}

 I have not updated this error status code for
 [https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-admin
 /media-new.php#L35 src/wp-admin/media-new.php:35] from a 500 error, as
 there are a variety of error codes that it could be within the
 `media_handle_upload()` and `_wp_handle_upload()` functions.

 However this does raise a question around if we could obtain the error
 code from these functions in some way for use within the `wp_die()`
 function? I have done some digging here, and nothing obvious presented
 itself, so I am not sure how we would best update this instance.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64010#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list