Skip to content

Commit

Permalink
Only add customizer additional CSS to global styles in block themes (#…
Browse files Browse the repository at this point in the history
…63331)

Co-authored-by: tellthemachines <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: andrewserong <[email protected]>
  • Loading branch information
4 people committed Jul 15, 2024
1 parent a717254 commit 5ce11d9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ function gutenberg_enqueue_global_styles() {

$stylesheet = gutenberg_get_global_stylesheet();

/*
* Dequeue the Customizer's custom CSS
* and add it before the global styles custom CSS.
*/
remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
// Get the custom CSS from the Customizer and add it to the global stylesheet.
$custom_css = wp_get_custom_css();
$stylesheet .= $custom_css;
if ( $is_block_theme ) {
/*
* Dequeue the Customizer's custom CSS
* and add it before the global styles custom CSS.
*/
remove_action( 'wp_head', 'wp_custom_css_cb', 101 );
// Get the custom CSS from the Customizer and add it to the global stylesheet.
$custom_css = wp_get_custom_css();
$stylesheet .= $custom_css;

// Add the global styles custom CSS at the end.
$stylesheet .= gutenberg_get_global_stylesheet( array( 'custom-css' ) );
// Add the global styles custom CSS at the end.
$stylesheet .= gutenberg_get_global_stylesheet( array( 'custom-css' ) );
}

if ( empty( $stylesheet ) ) {
return;
Expand Down

0 comments on commit 5ce11d9

Please sign in to comment.