Make WordPress Core

Opened 4 weeks ago

Last modified 3 weeks ago

#62030 new defect (bug)

Can't Access Some Block Templates in Classic Themes

Reported by: woodardmc's profile woodardmc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.6.2
Component: Editor Keywords:
Focuses: administration, template Cc:

Description

In classic themes that have the block-templates theme support I've found that block templates with certain names become unmanageable after creation. This seems to be because their slugs are special or reserved in some way.
The two names I've found so far are "home" and "archive".

If you create a block template with these names, they are still used on the frontend as normal. However, they do not appear in the list of templates you can edit and trying to access them from the template editor's command palette leads to an error reporting: "The theme you are currently using is not compatible with the Site Editor."

This means that I can create a template that will potentially get used as my site's archive template, but I cannot edit or remove it.

I would expect any block template I can create in a classic theme through the template editor to be manageable from there as well.
Otherwise, if I shouldn't be able to manage these templates, then I shouldn't be able to create them either.

My Test Environment

  • WordPress: 6.6.2
  • PHP: 8.1.9
  • MySQL: 8.0.16
  • Theme: Twenty Twenty One with block-templates theme support added.
  • Plugins: none

Steps to Reproduce

  • Create a new page.
  • Click the template button.
  • Choose to create a new template.
  • Name the template "archive"
  • Save the template. (you may see an error that saving failed)
  • Check the wp_posts table for a new wp_template post, see that the "archive" template is in the table.
  • Load an archive page on your site, see that the new "archive" block template is being applied.
  • Go back to editing the page and refresh the page
  • Click the template button.
  • The "archive" template just created does not appear here and cannot be edited.

Here is a video of the issue as well: https://www.loom.com/share/005335d1ca0e4869b4980976f96a6a5b

Change History (2)

#1 @poena
3 weeks ago

  • Component changed from Themes to Editor

I don't think the intention is that these templates should be created using this flow, after all you are editing a page, creating a page template, not an archive template.

I think this is a bug where these names should be reserved: but I also think you would get more traction if you moved the report to the Gutenberg GitHub repository, where changes to the editor are managed.

This ticket was mentioned in Slack in #core-editor by poena. View the logs.


3 weeks ago

Note: See TracTickets for help on using tickets.