You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Block templates with specific postTypes that have been edited by the user can be selected for any other post type #43557
[Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Type] BugAn existing feature does not function as intended
I originally opened this issue in Trac, but moving it here for better visibility.
When a block template provided by a theme has been edited by the user, the postTypes argument is ignored, so the template is available for the wrong post types.
Step-by-step reproduction instructions
With a block theme (I used Twenty Twenty Two), create two templates and add them to theme.json:
{
"version": 2,
"customTemplates": [
....
{
"name": "custom-single-post-template",
"title": "Custom Single Post template",
"postTypes": [
"post"
]
},
{
"name": "custom-single-post-template-not-modified",
"title": "Custom Single Post template (not modified)",
"postTypes": [
"post"
]
}
],
...
}
Go to Appearance > Editor > Templates and make a modification to Custom Single Post template.
Now, create a new page.
Notice in the Template panel in the sidebar, Custom Single Post template is available while Custom Single Post template (not modified) isn't.
Expected behavior
If the user modifies a template in the Site Editor, that shouldn't affect which post types that template is available for.
[Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Type] BugAn existing feature does not function as intended
Activity
Aljullu commentedon Aug 24, 2022
PR created in wordpress-develop: WordPress/wordpress-develop#3131
Mamaduka commentedon Aug 24, 2022
Thanks for the core PR, @Aljullu.
I had a WIP branch for the plugin, which is slightly different from your patch. So I will try to create PR tomorrow morning.