Add is_customize_preview(), a conditional function to check if the site is being previewed in the Customizer.

props sammybeats, mattwiebe.
fixes #23509.
Built from https://develop.svn.wordpress.org/trunk@28999


git-svn-id: http://core.svn.wordpress.org/trunk@28787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-07-04 16:17:15 +00:00
parent 53bd731570
commit 7197468003
1 changed files with 13 additions and 0 deletions

View File

@ -1938,3 +1938,16 @@ function wp_customize_support_script() {
</script>
<?php
}
/**
* Whether the site is being previewed in the Customizer.
*
* @since 4.0.0
*
* @return bool True if the site is being previewed in the Customizer, false otherwise.
*/
function is_customize_preview() {
global $wp_customize;
return is_a( $wp_customize, 'WP_Customize_Manager' ) && $wp_customize->is_preview();
}