Make WordPress Core

Changeset 40316


Ignore:
Timestamp:
03/23/2017 04:56:57 PM (8 years ago)
Author:
westonruter
Message:

Customize: Fix selective refresh when customizing the 404 template.

Overrides the 404 status during partial refresh requests to serve back 200 so that the request is not deemed a failure and invoke the fallback behavior (full refresh).

See #27355.
Fixes #40018.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-selective-refresh.php

    r39734 r40316  
    325325        if ( ! is_customize_preview() ) {
    326326            wp_send_json_error( 'expected_customize_preview', 403 );
    327         } else if ( ! isset( $_POST['partials'] ) ) {
     327        } elseif ( ! isset( $_POST['partials'] ) ) {
    328328            wp_send_json_error( 'missing_partials', 400 );
    329329        }
     330
     331        // Ensure that doing selective refresh on 404 template doesn't result in fallback rendering behavior (full refreshes).
     332        status_header( 200 );
    330333
    331334        $partials = json_decode( wp_unslash( $_POST['partials'] ), true );
Note: See TracChangeset for help on using the changeset viewer.