gutenberg_render_block_core_template_part should validate postId attribute as ID for a wp_template_part post #26734
Labels
[Block] Template Part
Affects the Template Parts Block
[Type] Bug
An existing feature does not function as intended
Describe the bug
When I first started developing my experimental FSE theme called Fizzie I used export as CSV from the original site, updated the template parts, then tried to use them directly in another site.
I discovered that the
postId
attribute was not being fully validated.This led to a lot of confusion until I determined that the posts being loaded were not template parts at all.
I realised that, so long as
get_post_status()
returns a non null value any content could be loaded.To reproduce
Steps to reproduce the behavior:
postId
attribute on awp:template-part
block to be a valid post ID.Expected behavior
The post that's found using the
postId
attribute should only be used if the post_type of the post iswp_template_part
.The status should also be checked to be
published
.Any other status should not be allowed.
Screenshots
See bobbingwide/fizzie#1 (comment)
Editor version (please complete the following information):
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: