Theme Customizer: Introduce a remove_preview_signature() method that we can employ to ensure we do not think a wp_die() is a customizer-generated preview. see #20507.

git-svn-id: http://core.svn.wordpress.org/trunk@20926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-05-26 04:34:45 +00:00
parent e178acf108
commit db5af1d1f6
1 changed files with 12 additions and 0 deletions

View File

@ -265,6 +265,7 @@ final class WP_Customize_Manager {
add_action( 'wp_head', array( $this, 'customize_preview_base' ) ); add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 ); add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) );
foreach ( $this->settings as $setting ) { foreach ( $this->settings as $setting ) {
$setting->preview(); $setting->preview();
@ -312,6 +313,17 @@ final class WP_Customize_Manager {
echo 'WP_CUSTOMIZER_SIGNATURE'; echo 'WP_CUSTOMIZER_SIGNATURE';
} }
/**
* Removes the signature in case we experience a case where the customizer was not properly executed.
*
* @since 3.4.0
*/
public function remove_preview_signature( $return = null ) {
remove_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
return $return;
}
/** /**
* Is it a theme preview? * Is it a theme preview?
* *