Prevent sending a 404 status when returning the response for the customize preview, since it causes the jQuery Ajax to fail. Send 200 instead.

props westonruter.
fixes #27992.
Built from https://develop.svn.wordpress.org/trunk@28970


git-svn-id: http://core.svn.wordpress.org/trunk@28759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-07-03 16:10:15 +00:00
parent 4e75d406ec
commit 2f344b9d3c
1 changed files with 13 additions and 0 deletions

View File

@ -406,6 +406,7 @@ final class WP_Customize_Manager {
$this->prepare_controls(); $this->prepare_controls();
wp_enqueue_script( 'customize-preview' ); wp_enqueue_script( 'customize-preview' );
add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) );
add_action( 'wp_head', array( $this, 'customize_preview_base' ) ); add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
add_action( 'wp_head', array( $this, 'customize_preview_html5' ) ); add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
@ -427,6 +428,18 @@ final class WP_Customize_Manager {
do_action( 'customize_preview_init', $this ); do_action( 'customize_preview_init', $this );
} }
/**
* Prevent sending a 404 status when returning the response for the customize
* preview, since it causes the jQuery Ajax to fail. Send 200 instead.
*
* @since 4.0.0
*/
public function customize_preview_override_404_status() {
if ( is_404() ) {
status_header( 200 );
}
}
/** /**
* Print base element for preview frame. * Print base element for preview frame.
* *