Skip to content

Commit

Permalink
Enqueue global styles in editor only once (#32377)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolosw authored Jun 8, 2021
1 parent 80ef88b commit dbb195d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ function_exists( 'gutenberg_is_edit_site_page' ) &&
'__experimentalNoWrapper' => true,
);

// Reset existing global styles.
foreach ( $settings['styles'] as $key => $style ) {
if ( isset( $style['__unstableType'] ) && 'globalStyles' === $style['__unstableType'] ) {
unset( $settings['styles'][ $key ] );
}
}

// Add the new ones.
$settings['styles'][] = $css_variables;
$settings['styles'][] = $block_styles;
}
Expand Down

0 comments on commit dbb195d

Please sign in to comment.