[wp-trac] [WordPress Trac] #51612: `render_block_data` for nested blocks - WP_Block::render vs render_block

WordPress Trac noreply at wordpress.org
Thu Nov 5 06:52:14 UTC 2020


#51612: `render_block_data` for nested blocks - WP_Block::render vs render_block
--------------------------+-----------------------------
 Reporter:  gaambo        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Editor        |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------------

Comment (by noisysocks):

 Thanks for the report @gaambo.

 We should be applying these filters inside `WP_Block::_construct` as well.

 To test, add these filters and then open a post that has some blocks
 inside a Group block. Note that the filters aren't called for the inner
 blocks.

 {{{#!php
 <?php
 add_filter(
         'pre_render_block',
         function( $pre_render, $parsed_block ) {
                 var_dump( 'pre_render_block', $pre_render, $parsed_block
 );
         },
         10,
         2
 );

 add_filter(
         'render_block_data',
         function( $parsed_block, $source_block ) {
                 var_dump( 'render_block_data', $parsed_block,
 $source_block );
         },
         10,
         2
 );

 add_filter(
         'render_block_context',
         function( $context, $parsed_block ) {
                 var_dump( 'render_block_context', $context, $parsed_block
 );
         },
         10,
         2
 );
 }}}

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


More information about the wp-trac mailing list