From 40ae89369f15e0844e91a1abb58cb5f7b0487b97 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 5 Dec 2012 02:34:00 +0000 Subject: [PATCH] Admin ajax: Roll back new-style error sending in set-post-thumbnail. The JS handlers know to parse an unrecognized response (like -1 or 0) as a failure. see #21776. see #22750. git-svn-id: http://core.svn.wordpress.org/trunk@23058 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 72a6fa3240..c33e383776 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1677,9 +1677,9 @@ function wp_ajax_set_post_thumbnail() { $json = ! empty( $_REQUEST['json'] ); // New-style request $post_ID = intval( $_POST['post_id'] ); - if ( !current_user_can( 'edit_post', $post_ID ) ) { - $json ? wp_send_json_error() : wp_die( -1 ); - } + if ( ! current_user_can( 'edit_post', $post_ID ) ) + wp_die( -1 ); + $thumbnail_id = intval( $_POST['thumbnail_id'] ); if ( $json ) @@ -1692,7 +1692,7 @@ function wp_ajax_set_post_thumbnail() { $return = _wp_post_thumbnail_html( null, $post_ID ); $json ? wp_send_json_success( $return ) : wp_die( $return ); } else { - $json ? wp_send_json_error() : wp_die( 0 ); + wp_die( 0 ); } } @@ -1701,7 +1701,7 @@ function wp_ajax_set_post_thumbnail() { $json ? wp_send_json_success( $return ) : wp_die( $return ); } - $json ? wp_send_json_error() : wp_die( 0 ); + wp_die( 0 ); } function wp_ajax_date_format() {