Block templates with specific postTypes that have been edited by the user can be selected for any other post type #43557
Labels
[Feature] Templates API
Related to API powering block template functionality in the Site Editor
[Type] Bug
An existing feature does not function as intended
Description
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
Expected behavior
If the user modifies a template in the Site Editor, that shouldn't affect which post types that template is available for.
Additional info
I think the issue is caused by
_build_block_template_result_from_post()
not setting a post_types attribute to the returned templates._build_block_template_result_from_post()
is used byget_block_template()
.We identified that issue when working on WooCommerce templates. See woocommerce/woocommerce#42630.
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
The text was updated successfully, but these errors were encountered: