Skip to content

Commit

Permalink
Simplify logic to set origin
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 22, 2022
1 parent 841bcfc commit b0a3cc8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/compat/wordpress-6.2/get-global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,13 @@ function gutenberg_get_global_settings( $path = array(), $context = array() ) {
$path = array_merge( array( 'blocks', $context['block_name'] ), $path );
}

// This is the default value when no origin is provided or when it is 'all'.
$origin = 'custom';
if ( ! wp_theme_has_theme_json() ) {
// For themes with no theme.json skip querying the database for user data (custom origin).
$origin = 'theme';
} elseif ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
$origin = 'theme';
} elseif ( isset( $context['origin'] ) && 'all' === $context['all'] ) {
$origin = 'custom';
}

$settings = WP_Theme_JSON_Resolver_Gutenberg::get_merged_data( $origin )->get_settings();
Expand Down

0 comments on commit b0a3cc8

Please sign in to comment.