From 8d4d20db2d7ce80d0c325713c96b1e0c392fa0da Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 23 Mar 2017 16:56:57 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@40316 602fd350-edb4-49c9-b593-d223f7449a82 --- .../customize/class-wp-customize-selective-refresh.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 23d5a94885..6c04a73698 100644 --- a/src/wp-includes/customize/class-wp-customize-selective-refresh.php +++ b/src/wp-includes/customize/class-wp-customize-selective-refresh.php @@ -324,10 +324,13 @@ final class WP_Customize_Selective_Refresh { */ if ( ! is_customize_preview() ) { wp_send_json_error( 'expected_customize_preview', 403 ); - } else if ( ! isset( $_POST['partials'] ) ) { + } elseif ( ! isset( $_POST['partials'] ) ) { wp_send_json_error( 'missing_partials', 400 ); } + // Ensure that doing selective refresh on 404 template doesn't result in fallback rendering behavior (full refreshes). + status_header( 200 ); + $partials = json_decode( wp_unslash( $_POST['partials'] ), true ); if ( ! is_array( $partials ) ) {