Theme Customizer: Add a signature to preview requests to be super-double-ultra-sure that the customizer generated the preview. Redirects can be sneaky. fixes #20507, see #19910.

git-svn-id: https://develop.svn.wordpress.org/trunk@20925 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-05-26 04:08:44 +00:00
parent a621d3e326
commit 0847bf3b89
2 changed files with 21 additions and 1 deletions
@@ -264,6 +264,7 @@ final class WP_Customize_Manager {
wp_enqueue_script( 'customize-preview' );
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 );
foreach ( $this->settings as $setting ) {
$setting->preview();
@@ -302,6 +303,15 @@ final class WP_Customize_Manager {
<?php
}
/**
* Prints a signature so we can ensure the customizer was properly executed.
*
* @since 3.4.0
*/
public function customize_preview_signature() {
echo 'WP_CUSTOMIZER_SIGNATURE';
}
/**
* Is it a theme preview?
*