diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php index 898152d6c7..9a41239e76 100644 --- a/src/wp-includes/class-wp-customize-nav-menus.php +++ b/src/wp-includes/class-wp-customize-nav-menus.php @@ -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( diff --git a/src/wp-includes/customize/class-wp-customize-selective-refresh.php b/src/wp-includes/customize/class-wp-customize-selective-refresh.php index 245d32a27b..95c1934d38 100644 --- a/src/wp-includes/customize/class-wp-customize-selective-refresh.php +++ b/src/wp-includes/customize/class-wp-customize-selective-refresh.php @@ -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 );