Skip to content

Blank page when templates/index.html exists in classic themes. #38315

Open
@costdev

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

  1. Create a classic theme which happens to include an empty templates/index.html.
  2. Activate the theme.
  • The Editor item will be available and the frontend will (likely) output Empty template: Index.
  1. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Needs Technical FeedbackNeeds testing from a developer perspective.[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Status] BlockedUsed to indicate that a current effort isn't able to move forward[Type] WP Core TicketRequires an upstream change from WordPress. Core Trac ticket should be linked.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions