diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php
index 5d24da07b4..29657df228 100644
--- a/wp-includes/class-wp-theme.php
+++ b/wp-includes/class-wp-theme.php
@@ -338,10 +338,15 @@ final class WP_Theme implements ArrayAccess {
if ( ! $this->template ) {
$this->template = $this->stylesheet;
- if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) {
+ $theme_path = $this->theme_root . '/' . $this->stylesheet;
+
+ if ( ! file_exists( $theme_path . '/templates/index.html' )
+ && ! file_exists( $theme_path . '/index.php' )
+ ) {
$error_message = sprintf(
- /* translators: 1: index.php, 2: Documentation URL, 3: style.css */
- __( 'Template is missing. Standalone themes need to have a %1$s template file. Child themes need to have a Template header in the %3$s stylesheet.' ),
+ /* translators: 1: templates/index.html, 2: index.php, 3: Documentation URL, 4: style.css */
+ __( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. Child themes need to have a Template header in the %4$s stylesheet.' ),
+ 'templates/index.html
',
'index.php
',
__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ),
'style.css
'
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index feec9b3de4..ed24f677ef 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -830,7 +830,10 @@ function switch_theme( $stylesheet ) {
}
/**
- * Checks that the active theme has 'index.php' and 'style.css' files.
+ * Checks that the active theme has the required files.
+ *
+ * Standalone themes need to have a `templates/index.html` or `index.php` template file.
+ * Child themes need to have a `Template` header in the `style.css` stylesheet.
*
* Does not initially check the default theme, which is the fallback and should always exist.
* But if it doesn't exist, it'll fall back to the latest core default theme that does exist.
@@ -840,6 +843,7 @@ function switch_theme( $stylesheet ) {
* this functionality.
*
* @since 1.5.0
+ * @since 6.0.0 Removed the requirement for block themes to have an `index.php` template.
*
* @see WP_DEFAULT_THEME
*
@@ -857,7 +861,9 @@ function validate_current_theme() {
return true;
}
- if ( ! file_exists( get_template_directory() . '/index.php' ) ) {
+ if ( ! file_exists( get_template_directory() . '/templates/index.html' )
+ && ! file_exists( get_template_directory() . '/index.php' )
+ ) {
// Invalid.
} elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) {
// Invalid.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 9ffb0070b5..c38ab7f2b9 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.0-alpha-52939';
+$wp_version = '6.0-alpha-52940';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.