Skip to content

FSE - Template meta information and post type support do not work #31704

@rufus87

Description

@rufus87

Description

Custom template configuration in experimental-theme.json file does not work neither in default themes nor in custom ones.

Step-by-step reproduction instructions

  1. Create my-custom-template.html file within current active theme's "block-templates" folder
  2. Add configuration from Code snippet part to active theme's experimental-theme.json file
  3. Go to admin panel and go to "Posts -> Add New"
  4. In the opened screen open "Template dropdown"

Expected behaviour

  1. Template dropdown should not contain above mentioned my-custom-template as an option because it should not be available for any post type but page.
  2. The template name must be read as The template title instead of my-custom-template based on experimental-theme.json file configuration

Actual behaviour

  1. Template is available in all post types: postTypes restriction does not work
  2. Template name is read as my-custom-template instead of The template title

Screenshots or screen recording (optional)

image
image
image

Code snippet (optional)

...
"customTemplates": [
    {
      "name": "my-custom-template",
      "title": "The template title",
      "postTypes": [
        "page"
      ]
    }
  ]
...

WordPress information

  • WordPress version: 5.7.1
  • Gutenberg version: 10.5.4
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome 90.0.4430.93 (Official Build) (64-bit)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions