[wp-trac] [WordPress Trac] #51612: `render_block_data` for nested blocks - WP_Block::render vs render_block
WordPress Trac
noreply at wordpress.org
Thu Aug 19 23:28:37 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 azaozz):
Replying to [comment:50 gaambo]:
> 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
Yes, was thinking like that may work. As far as I see a solution can be
based on replacing
{{{
$block_content .= is_string( $chunk ) ?
$chunk :
$this->inner_blocks[ $index++ ]->render();
}}}
with something like
{{{
if ( is_string( $chunk ) ) {
$block_content .= $chunk;
} else {
$block_content .= render_block( $this->inner_blocks[ $index
]->parsed_block );
$index++;
}
}}}
Can you see if that change fixes the filter problem and if there are any
unwanted side effects, and perhaps make an "official" PR or patch as the
change is mostly like your gist anyway :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51612#comment:52>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list