Make WordPress Core

Changeset 40366


Ignore:
Timestamp:
04/03/2017 10:14:33 PM (7 years ago)
Author:
swissspidy
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.

Merges [40316] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/customize/class-wp-customize-selective-refresh.php

    r39571 r40366  
    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.