Themes: Accept valid block themes.

Updates theme validation to accept block themes. This replaces the requirement for an `index.php` with a requirement for either an `index.php`, `/templates/index.html` or the deprecated `/block-templates/index.html`.

Validation is updated for theme uploads, within `WP_Theme::__construct` and `validate_current_theme()`. 

A block theme using the deprecated file structure is now included in the unit tests.

Props peterwilsoncc, sergeybiryukov, hellofromtonya, costdev, azaozz, gziolo, FlorianBrinkmann, Boniu91, aristath, poena, audrasjb.
Fixes #55754.


git-svn-id: https://develop.svn.wordpress.org/trunk@53416 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2022-05-20 00:47:45 +00:00
parent 96d6eae601
commit 72bc35114b
13 changed files with 166 additions and 19 deletions
+3 -1
View File
@@ -861,7 +861,9 @@ function validate_current_theme() {
return true;
}
if ( ! file_exists( get_template_directory() . '/templates/index.html' )
if (
! file_exists( get_template_directory() . '/templates/index.html' )
&& ! file_exists( get_template_directory() . '/block-templates/index.html' ) // Deprecated path support since 5.9.0.
&& ! file_exists( get_template_directory() . '/index.php' )
) {
// Invalid.