You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gutenberg_render_block does not render inner blocks #8214
Needs TestingNeeds further testing to be confirmed.[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P
Testing this again WordPress 5.0.3 and in mind of #11334, the original issue of inner blocks not being included in the rendered markup has been resolved. The two contents are not identical, but only in that the comment demarcations are removed during the "render" (expected).
<divclass="wp-block-columns has-2-columns"><divclass="wp-block-column"><p>This is a column</p></div><divclass="wp-block-column"><p>This is the other column</p></div></div>
Closing this as fixed, but let's plan to reopen if it continues to be an issue, or open separate issues if further improvements are necessary.
A possibly related issue arises when using InnerBlocks with custom post types set to be the front page of a site via the Reading settings in the backend.
If that custom post type piece of content has InnerBlocks in them, they are not rendered using the usual the_content function call in a template part.
Using do_blocks and passing the content to it does render all the InnerBlocks.
Steps to reproduce:
Create / register a custom post type.
Create new CPT page
Add InnerBlocks
Save page
Allow CPT to be selected as the front page using the get_pages filter and pre_get_posts action to set the URL and post_type correctly.
Load home page on front-end. All blocks with InnerBlocks are not rendered. Regular blocks render correctly.
code below does not work:
// inside the loop
the_content( sprintf(
/* translators: %s: Name of current post. */
wp_kses( __( 'Continue reading %s <span class="meta-nav">→</span>', 'oep' ), [ 'span' => [ 'class' => [] ] ] ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
));
@ryanapsmith I would expect your original (non-working) code snippet should not be effectively any different than the second (working) one, at least as far as blocks processing is concerned. It may be a matter of how you get_the_ID works different in your second snippet.
The the_content function applies the the_content filter:
Needs TestingNeeds further testing to be confirmed.[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P
Activity
aduth commentedon Feb 4, 2019
Testing this again WordPress 5.0.3 and in mind of #11334, the original issue of inner blocks not being included in the rendered markup has been resolved. The two contents are not identical, but only in that the comment demarcations are removed during the "render" (expected).
Script:
Output:
Closing this as fixed, but let's plan to reopen if it continues to be an issue, or open separate issues if further improvements are necessary.
ryanapsmith commentedon May 17, 2019
A possibly related issue arises when using InnerBlocks with custom post types set to be the front page of a site via the Reading settings in the backend.
If that custom post type piece of content has InnerBlocks in them, they are not rendered using the usual the_content function call in a template part.
Using do_blocks and passing the content to it does render all the InnerBlocks.
Steps to reproduce:
code below does not work:
following code does work:
the issue here #8019 was what I eventually use to resolve this.
aduth commentedon May 21, 2019
@ryanapsmith I would expect your original (non-working) code snippet should not be effectively any different than the second (working) one, at least as far as blocks processing is concerned. It may be a matter of how you
get_the_IDworks different in your second snippet.The
the_contentfunction applies thethe_contentfilter:https://github.com/WordPress/wordpress-develop/blob/f9e4f60577023a81de301069835afa013e697a25/src/wp-includes/post-template.php#L247
do_blocksis a default callback for thethe_contentfilter:https://github.com/WordPress/wordpress-develop/blob/f9e4f60577023a81de301069835afa013e697a25/src/wp-includes/default-filters.php#L172
ryanapsmith commentedon May 28, 2019
@aduth will explore the get_the_ID angle a bit more, thanks!