Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 54d7734

Browse files
authored
Global styles: allow override to work when Gutenberg plugin is active (#8638)
1 parent f2ecaf5 commit 54d7734

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

blockbase/inc/rest-api.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ function blockbase_remove_style_variations_from_child_themes( $response, $handle
1717
$handler_method = isset( $handler['callback'][1] ) ? $handler['callback'][1] : null;
1818
$opt_out = wp_get_global_settings( array( 'custom', 'optOutOfParentStyleVariations' ) );
1919

20+
// Global styles are overridden when Gutenberg plugin is used.
21+
$check_class = class_exists( 'WP_REST_Global_Styles_Controller_Gutenberg' ) ? 'WP_REST_Global_Styles_Controller_Gutenberg' : 'WP_REST_Global_Styles_Controller';
22+
2023
/*
2124
* Prevents Blockbase child themes from being considered child themes in the
2225
* `wp/v2/global-styles/themes/:theme/variations` API endpoint, so they don't
2326
* inherit the style variations from the parent theme.
2427
*/
25-
if ( $opt_out && is_a( $handler_class, 'WP_REST_Global_Styles_Controller' ) && 'get_theme_items' === $handler_method ) {
28+
if ( $opt_out && is_a( $handler_class, $check_class ) && 'get_theme_items' === $handler_method ) {
2629
add_filter( 'template_directory', 'get_stylesheet_directory' );
2730
}
2831

0 commit comments

Comments
 (0)