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

WordPress Trac noreply at wordpress.org
Mon Jul 12 07:05:25 UTC 2021


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

Comment (by gaambo):

 Replying to [comment:49 jakeparis]:
 > I just want to thumbs up this request (not exactly sure what the trac-
 approved way to add support to a request is). This issue stopped me in my
 tracks when writing something to replace a specific block upon render.
 >
 > If the original block is in a column or a group, my filter doesn't run
 at all. Are there any known workarounds for this issue?

 I've coded a workaround which uses `render_block_data` to render all child
 blocks recursively with `render_block`:
 https://gist.github.com/gaambo/16c7fb6fd758e4eb72e0f5db3888dd40

 Works up to WordPress 5.7, haven't tested with 5.8 - if you notice any
 errors/bugs feel free to comment under the gist.

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


More information about the wp-trac mailing list