Skip to content

Commit 87be9ed

Browse files
committed
Fix ability to preview Custom CSS changes in the Customizer
1 parent 1acfccc commit 87be9ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/script-loader.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ function gutenberg_enqueue_global_styles() {
4444

4545
$stylesheet = gutenberg_get_global_stylesheet();
4646

47-
if ( $is_block_theme ) {
47+
if ( $is_block_theme && ! is_customize_preview() ) {
4848
/*
4949
* Dequeue the Customizer's custom CSS
5050
* and add it before the global styles custom CSS.
51+
* This is not done in the Customizer preview to
52+
* facilitate live previewing changes via
53+
* wp-includes/js/customize-preview.js.
5154
*/
5255
remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
5356
// Get the custom CSS from the Customizer and add it to the global stylesheet.
@@ -79,7 +82,7 @@ function gutenberg_enqueue_global_styles() {
7982
*/
8083
function gutenberg_enqueue_global_styles_custom_css() {
8184
_deprecated_function( __FUNCTION__, 'Gutenberg 17.8.0', 'gutenberg_enqueue_global_styles' );
82-
if ( ! wp_is_block_theme() ) {
85+
if ( ! wp_is_block_theme() || is_customize_preview() ) {
8386
return;
8487
}
8588

0 commit comments

Comments
 (0)