From 7178b676714b60f4a068c395cf36f351ab01a0d7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 10 Sep 2015 17:17:22 +0000 Subject: [PATCH] `media-new.php`, when using the browser uploader, if the result of uploading is a `WP_Error` - `wp_die()` with the error, instead of redirecting with a generic error. Props solarissmoke. Fixes #16820. git-svn-id: https://develop.svn.wordpress.org/trunk@34002 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/media-new.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/media-new.php b/src/wp-admin/media-new.php index c8263d8ac9..9d26651e85 100644 --- a/src/wp-admin/media-new.php +++ b/src/wp-admin/media-new.php @@ -25,15 +25,15 @@ if ( isset( $_REQUEST['post_id'] ) ) { } if ( $_POST ) { - $location = 'upload.php'; if ( isset($_POST['html-upload']) && !empty($_FILES) ) { check_admin_referer('media-form'); // Upload File button was clicked - $id = media_handle_upload( 'async-upload', $post_id ); - if ( is_wp_error( $id ) ) - $location .= '?message=3'; + $upload_id = media_handle_upload( 'async-upload', $post_id ); + if ( is_wp_error( $upload_id ) ) { + wp_die( $upload_id ); + } } - wp_redirect( admin_url( $location ) ); + wp_redirect( admin_url( 'upload.php' ) ); exit; }