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. git-svn-id: https://develop.svn.wordpress.org/trunk@28970 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8bf7ed77f3
commit
09efb2dab9
@ -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.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user