Last active
August 29, 2015 14:05
-
-
Save matthewpizza/71b7973837a39db6a49f to your computer and use it in GitHub Desktop.
JavaScript check to see if a WordPress site is currently being loaded by the Theme Customizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Is this WordPress site currently being loaded in the theme customizer iframe? | |
| * | |
| * @return {Boolean} Most likely. | |
| */ | |
| function isThemeCustomizer() { | |
| if ( window.parent.location === window.location ) { | |
| return false; | |
| } | |
| if ( null === window.parent.document.getElementById( 'customize-preview' ) ) { | |
| return false; | |
| } | |
| return true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment