Themes: Check both parent and child themes for a `theme.json` file.

This updates `WP_Theme_JSON_Resolver::theme_has_support()` to properly check for a `theme.json` file in both parent and child themes when determining whether a theme supports block templates.

Follow up to [52077].

Props Mamaduka.
Fixes #54401.
Built from https://develop.svn.wordpress.org/trunk@52181


git-svn-id: http://core.svn.wordpress.org/trunk@51773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-11-16 14:58:59 +00:00
parent c5518c2f11
commit 533afcd3b9
2 changed files with 5 additions and 2 deletions

View File

@ -363,7 +363,10 @@ class WP_Theme_JSON_Resolver {
*/ */
public static function theme_has_support() { public static function theme_has_support() {
if ( ! isset( self::$theme_has_support ) ) { if ( ! isset( self::$theme_has_support ) ) {
self::$theme_has_support = is_readable( self::get_file_path_from_theme( 'theme.json' ) ); self::$theme_has_support = (
is_readable( self::get_file_path_from_theme( 'theme.json' ) ) ||
is_readable( self::get_file_path_from_theme( 'theme.json', true ) )
);
} }
return self::$theme_has_support; return self::$theme_has_support;

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.9-alpha-52180'; $wp_version = '5.9-alpha-52181';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.