diff --git a/wp-includes/global-styles-and-settings.php b/wp-includes/global-styles-and-settings.php index c625166524..a0b91a4d21 100644 --- a/wp-includes/global-styles-and-settings.php +++ b/wp-includes/global-styles-and-settings.php @@ -264,6 +264,26 @@ function wp_add_global_styles_for_blocks() { * @return bool Returns true if theme or its parent has a theme.json file, false otherwise. */ function wp_theme_has_theme_json() { + static $theme_has_support = null; + + if ( + null !== $theme_has_support && + /* + * Ignore static cache when `WP_DEBUG` is enabled. Why? To avoid interfering with + * the theme developer's workflow. + * + * @todo Replace `WP_DEBUG` once an "in development mode" check is available in Core. + */ + ! WP_DEBUG && + /* + * Ignore cache when automated test suites are running. Why? To ensure + * the static cache is reset between each test. + */ + ! ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) + ) { + return $theme_has_support; + } + // Does the theme have its own theme.json? $theme_has_support = is_readable( get_stylesheet_directory() . '/theme.json' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ae2ee559d5..753999fca0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55137'; +$wp_version = '6.2-alpha-55138'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.