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

props sammybeats, mattwiebe.
fixes #23509.

git-svn-id: https://develop.svn.wordpress.org/trunk@28999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-07-04 16:16:46 +00:00
parent d075028201
commit fbda6f7c0a
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();
}