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

Props johnbillion.
See #35666.
Fixes #37897.


git-svn-id: https://develop.svn.wordpress.org/trunk@38478 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-08-31 19:00:59 +00:00
parent 73c5683903
commit 6631163639
2 changed files with 5 additions and 10 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 );