WordPress.org

Make WordPress Core

Changeset 38478


Ignore:
Timestamp:
08/31/2016 07:00:59 PM (3 years ago)
Author:
westonruter
Message:

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

Props johnbillion.
See #35666.
Fixes #37897.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r38436 r38478  
    750750    public function ajax_insert_auto_draft_post() {
    751751        if ( ! check_ajax_referer( 'customize-menus', 'customize-menus-nonce', false ) ) {
    752             status_header( 400 );
    753             wp_send_json_error( 'bad_nonce' );
     752            wp_send_json_error( 'bad_nonce', 400 );
    754753        }
    755754
    756755        if ( ! current_user_can( 'customize' ) ) {
    757             status_header( 403 );
    758             wp_send_json_error( 'customize_not_allowed' );
     756            wp_send_json_error( 'customize_not_allowed', 403 );
    759757        }
    760758
    761759        if ( empty( $_POST['params'] ) || ! is_array( $_POST['params'] ) ) {
    762             status_header( 400 );
    763             wp_send_json_error( 'missing_params' );
     760            wp_send_json_error( 'missing_params', 400 );
    764761        }
    765762
  • trunk/src/wp-includes/customize/class-wp-customize-selective-refresh.php

    r38470 r38478  
    316316         */
    317317        if ( ! is_customize_preview() ) {
    318             status_header( 403 );
    319             wp_send_json_error( 'expected_customize_preview' );
     318            wp_send_json_error( 'expected_customize_preview', 403 );
    320319        } else if ( ! isset( $_POST['partials'] ) ) {
    321             status_header( 400 );
    322             wp_send_json_error( 'missing_partials' );
     320            wp_send_json_error( 'missing_partials', 400 );
    323321        }
    324322
Note: See TracChangeset for help on using the changeset viewer.