diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 8cb315284b..6aba1c14d5 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -97,15 +97,10 @@ $admin_body_class .= ' no-customize-support'; "> + +
diff --git a/wp-includes/theme.php b/wp-includes/theme.php index fb9fc04eef..8bbf799a82 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1618,3 +1618,44 @@ add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' ); function wp_customize_url( $stylesheet ) { return esc_url( admin_url( 'customize.php' ) . '?theme=' . $stylesheet ); } + +/** + * Prints a script to check whether or not the customizer is supported, + * and apply either the no-customize-support or customize-support class + * to the body. + * + * This function MUST be called inside the body tag. + * + * Ideally, call this function immediately after the body tag is opened. + * This prevents a flash of unstyled content. + * + * It is also recommended that you add the "no-customize-support" class + * to the body tag by default. + * + * @since 3.4.0 + */ +function wp_customize_support_script() { + if ( ! wp_script_is( 'customize-loader', 'queue' ) ) + return; + + $admin_origin = parse_url( admin_url() ); + $home_origin = parse_url( home_url() ); + $cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) ); + + ?> + +