diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 1470c538416bf..d85c531d6cc74 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -2772,7 +2772,21 @@ public function merge( $incoming ) { // Replace the presets. foreach ( static::PRESETS_METADATA as $preset ) { - $override_preset = ! static::get_metadata_boolean( $this->theme_json['settings'], $preset['prevent_override'], true ); + $override_preset = false; + if ( is_array( $preset['prevent_override'] ) ) { + $prevent_override = _wp_array_get( $this->theme_json['settings'], $preset['prevent_override'] ); + /* + * For backwards compatibility with presets converting from a hardcoded `false` + * for `prevent_override` to a path to a boolean (`defaultFontSizes`, for example), + * the 'merge' value for the new setting both overrides the preset and tells the + * UI to continue to display a merged set of the default values. + */ + if ( 'merge' === $prevent_override ) { + $override_preset = true; + } elseif ( is_bool( $prevent_override ) ) { + $override_preset = ! $prevent_override; + } + } foreach ( static::VALID_ORIGINS as $origin ) { $base_path = $node['path']; diff --git a/lib/class-wp-theme-json-schema-gutenberg.php b/lib/class-wp-theme-json-schema-gutenberg.php index 99b6ab33614c3..c68a506c739d5 100644 --- a/lib/class-wp-theme-json-schema-gutenberg.php +++ b/lib/class-wp-theme-json-schema-gutenberg.php @@ -111,7 +111,7 @@ private static function migrate_v2_to_v3( $old ) { if ( ! isset( $old['settings']['typography'] ) ) { $new['settings']['typography'] = array(); } - $new['settings']['typography']['defaultFontSizes'] = false; + $new['settings']['typography']['defaultFontSizes'] = 'merge'; // Set the new version. $new['version'] = 3;