Customize: Use new `$status_code` parameter for `wp_send_json_error()` instead of calling `status_header()` separately.

Props johnbillion.
See #35666.
Fixes #37897.

Built from https://develop.svn.wordpress.org/trunk@38478


git-svn-id: http://core.svn.wordpress.org/trunk@38419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-08-31 19:01:28 +00:00
parent b4aaf3925d
commit bce5ea9494
3 changed files with 6 additions and 11 deletions

View File

@ -749,18 +749,15 @@ final class WP_Customize_Nav_Menus {
*/
public function ajax_insert_auto_draft_post() {
if ( ! check_ajax_referer( 'customize-menus', 'customize-menus-nonce', false ) ) {
status_header( 400 );
wp_send_json_error( 'bad_nonce' );
wp_send_json_error( 'bad_nonce', 400 );
}
if ( ! current_user_can( 'customize' ) ) {
status_header( 403 );
wp_send_json_error( 'customize_not_allowed' );
wp_send_json_error( 'customize_not_allowed', 403 );
}
if ( empty( $_POST['params'] ) || ! is_array( $_POST['params'] ) ) {
status_header( 400 );
wp_send_json_error( 'missing_params' );
wp_send_json_error( 'missing_params', 400 );
}
$params = wp_array_slice_assoc(

View File

@ -315,11 +315,9 @@ final class WP_Customize_Selective_Refresh {
* WP_Customize_Manager::setup_theme() is where the previewing flag is set.
*/
if ( ! is_customize_preview() ) {
status_header( 403 );
wp_send_json_error( 'expected_customize_preview' );
wp_send_json_error( 'expected_customize_preview', 403 );
} else if ( ! isset( $_POST['partials'] ) ) {
status_header( 400 );
wp_send_json_error( 'missing_partials' );
wp_send_json_error( 'missing_partials', 400 );
}
$partials = json_decode( wp_unslash( $_POST['partials'] ), true );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38477';
$wp_version = '4.7-alpha-38478';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.