Blank page when templates/index.html
exists in classic themes. #38315
Description
Description
See the related Trac ticket: https://core.trac.wordpress.org/ticket/54910
If a classic theme has templates/index.html
, which may be empty or have non-block HTML markup in it, it can be incorrectly identified as a block theme. For example, some developers and/or hosts, whether good practice or not, can place an index.html
file in every directory to prevent directory listing. Alternatively, some classic themes may have other uses for templates/index.html
, and the classic theme may not be actively, or regularly, maintained. This has resulted in some users receiving a white screen upon updating to 5.9.
An idea from @carolinan in the Trac ticket above suggested checking templates/index.html
for block markup. The patch aims to do exactly that. However, this needs insights and evaluation from the editor team regarding block theme architecture and we also need to consider performance. We've implemented caching using WP_Theme::cache_get()/add()/delete()
to help with this.
Step-by-step reproduction instructions
- Create a classic theme which happens to include an empty
templates/index.html
. - Activate the theme.
- The
Editor
item will be available and the frontend will (likely) outputEmpty template: Index
.
- Add some non-block HTML to
templates/index.html
.
- The
Editor
item will be available. - Viewing the Editor will (likely) show
This block has encountered an error and cannot be previewed.
. - The frontend will output the non-block HTML inside
.wp-site-blocks
.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Activity