From 255819e18a73650b03ea42776f55ddfaeb6b17cc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 5 Apr 2017 02:14:45 +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. Merges [40316] to the 4.7 branch. Built from https://develop.svn.wordpress.org/branches/4.7@40366 git-svn-id: http://core.svn.wordpress.org/branches/4.7@40273 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../customize/class-wp-customize-selective-refresh.php | 5 ++++- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/customize/class-wp-customize-selective-refresh.php b/wp-includes/customize/class-wp-customize-selective-refresh.php index af0c74d67b..76fb5a7090 100644 --- a/wp-includes/customize/class-wp-customize-selective-refresh.php +++ b/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 ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d71c0c96d..d77d083617 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7.4-alpha-40365'; +$wp_version = '4.7.4-alpha-40366'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.