diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php index b1f15897b1af5..e4afc3c1489d8 100644 --- a/src/wp-includes/class-wp-theme-json-resolver.php +++ b/src/wp-includes/class-wp-theme-json-resolver.php @@ -322,6 +322,11 @@ public static function get_theme_data( $deprecated = array(), $options = array() // Classic themes without a theme.json don't support global duotone. $theme_support_data['settings']['color']['defaultDuotone'] = false; + + // Allow themes to enable appearance tools via theme_support. + if ( current_theme_supports( 'appearance-tools' ) ) { + $theme_support_data['settings']['appearanceTools'] = true; + } } $with_theme_supports = new WP_Theme_JSON( $theme_support_data ); $with_theme_supports->merge( static::$theme ); diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index cd71b889e1c97..541699c686172 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -449,6 +449,9 @@ public function test_switching_themes_recalculates_data() { /** * @ticket 54336 + * @ticket 56467 + * + * @covers ::add_theme_support */ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json() { switch_theme( 'default' ); @@ -471,15 +474,18 @@ public function test_add_theme_supports_are_loaded_for_themes_without_theme_json ); add_theme_support( 'editor-color-palette', $color_palette ); add_theme_support( 'custom-line-height' ); + add_theme_support( 'appearance-tools' ); $settings = WP_Theme_JSON_Resolver::get_theme_data()->get_settings(); remove_theme_support( 'custom-line-height' ); remove_theme_support( 'editor-color-palette' ); + remove_theme_support( 'appearance-tools' ); $this->assertFalse( WP_Theme_JSON_Resolver::theme_has_support() ); $this->assertTrue( $settings['typography']['lineHeight'] ); $this->assertSame( $color_palette, $settings['color']['palette']['theme'] ); + $this->assertTrue( $settings['border']['color'], 'Support for appearance-tools was not added.' ); } /**