[wp-trac] [WordPress Trac] #62046: `render_block_context` filter works differently on top-level vs. inner blocks

WordPress Trac noreply at wordpress.org
Fri Sep 13 10:31:41 UTC 2024


#62046: `render_block_context` filter works differently on top-level vs. inner
blocks
----------------------------+------------------------------
 Reporter:  dlh             |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Editor          |     Version:  5.9
 Severity:  normal          |  Resolution:
 Keywords:  has-unit-tests  |     Focuses:
----------------------------+------------------------------

Comment (by gziolo):

 > Within WP_Block::render(), the WP_Block object for the inner block has
 already been instantiated (in WP_Block_List). The value returned by
 render_block_context is assigned directly to the inner block's $context
 property, so the logic in the constructor to provide that context to
 deeper inner blocks isn't invoked.

 Great findings. I was always unsure whether some of these filters should
 get applied in the constructor before `WP_Block_List` is instatiated. I'm
 wondering whether we would need to apply the filter there, too.

 By the way, I added some debug information on GitHub to illustrate better
 which path is responsible for calling filters depending on the scenario.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62046#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list