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

WordPress Trac noreply at wordpress.org
Mon Nov 11 17:27:54 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:  6.8
Component:  Editor                    |     Version:  5.9
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:
--------------------------------------+---------------------

Comment (by flixos90):

 I reviewed the PR and today's implementation further and I think
 identified the remaining key problem, which stems from the inconsistent
 place the filters are applied (before block instantiation vs after block
 instantiation).

 **TL;DR:** The main problem we still need to address is that
 `render_block_context` effectively filters a block's `$context` for inner
 blocks, but a block's `$available_context` for top-level blocks.

 See https://github.com/WordPress/wordpress-
 develop/pull/7522#pullrequestreview-2427816516.

 It would be great to get your perspectives on this @dlh @gziolo
 @joemcgill. Which of the two ways is in your opinion the way it ''should''
 work? Filter the actual `$context` (bypassing the `uses_context`
 restriction of the block) or filter the `$available_context`? Obviously
 the filter name makes me think it's the first, but let's ignore naming
 here for a moment to think about this from a behavior perspective.

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


More information about the wp-trac mailing list