Available block context does not flow to blocks inside the Post Template block #68608
Open
2 of 6 tasks
Labels
[Block] Post Template
Affects the Post Template Block
[Type] Bug
An existing feature does not function as intended
Description
I was trying to provide some context from the Query block down to the Post Title block (or any block inside the Post Template) and modified the suggestion described here.
But my custom context key was never available.
I tracked this down for a while and ultimately I think it is because of how the post template block is dynamically rendered. Specifically, it doesn't pass a 2nd parameter when instantiating the
new WP_Block()
for each post in the query's loop. So then in theWP_Block
class there's no available context to look at when setting the new block's context.Apologies if this should be reported to core somewhere.
At a minimum, if
Is changed to
Then any context on the post template block will be available for consumption on the post title and other nested blocks.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
WP 6.7.1
Twenty Twenty four
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: