From db5af1d1f61ae67ca1fedccf43e9ff6168953236 Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 26 May 2012 04:34:45 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-customize-manager.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 1de06949e..19c14570a 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -265,6 +265,7 @@ final class WP_Customize_Manager { add_action( 'wp_head', array( $this, 'customize_preview_base' ) ); add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 ); + add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) ); foreach ( $this->settings as $setting ) { $setting->preview(); @@ -312,6 +313,17 @@ final class WP_Customize_Manager { 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? *