From 650261b549641da046e492fbcf2e81c1d07d8217 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 27 Jun 2014 21:32:16 +0000 Subject: [PATCH] In deprecated media iframe code, `attachment_fields_to_save` filter should not be called twice after initial image upload in post. Props SergeyBiryukov. Fixes #20720. Built from https://develop.svn.wordpress.org/trunk@28871 git-svn-id: http://core.svn.wordpress.org/trunk@28671 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index c51dcad01d..d2cfb5cdf6 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -773,7 +773,10 @@ function wp_media_upload_handler() { return media_send_to_editor($html); } - if ( !empty($_POST) ) { + if ( isset( $_POST['save'] ) ) { + $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } elseif ( ! empty( $_POST ) ) { $return = media_upload_form_handler(); if ( is_string($return) ) @@ -782,11 +785,6 @@ function wp_media_upload_handler() { $errors = $return; } - if ( isset($_POST['save']) ) { - $errors['upload_notice'] = __('Saved.'); - return media_upload_gallery(); - } - if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) { $type = 'image'; if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )