Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
417cff4
Block Bindings: Support `innerBlocks` bindings on the Group and Colum…
cbravobernal Oct 29, 2026
818d554
Block Bindings: Keep `$inner_blocks` a `WP_Block_List` when a binding…
cbravobernal Oct 29, 2026
253c907
Block Bindings: Render `[embed]` shortcodes in bound inner blocks.
cbravobernal Oct 29, 2026
9200865
Block Bindings: Split the inner blocks bindings into named methods.
cbravobernal Oct 30, 2026
14c554d
Block Bindings: Use block comments in the inner blocks bindings tests.
cbravobernal Oct 30, 2026
c7e2952
Block Bindings: Remove inline comments from the inner blocks bindings…
cbravobernal Oct 30, 2026
a3771cc
Merge remote-tracking branch 'origin/trunk' into add/inner-blocks-bin…
cbravobernal Nov 10, 2026
d4819c0
Block Bindings: Skip only innerBlocks bindings that repeat a renderin…
cbravobernal Nov 10, 2026
cc235e1
Block Bindings: Keep inner blocks bindings from crashing on an empty …
cbravobernal Nov 10, 2026
fba872e
Block Bindings: Assert that the default pattern overrides binding ren…
cbravobernal Nov 10, 2026
0d3ce3a
Block Bindings: Forget blocks that stopped rendering with an exceptio…
cbravobernal Nov 11, 2026
1159d28
Block Bindings: Forget supplied inner blocks in a finally block inste…
cbravobernal Nov 11, 2026
d011bed
Block Bindings: Keep `innerBlocks` out of the editor only for the Gro…
cbravobernal Nov 11, 2026
d5155c3
Block Bindings: Supply the test embed through `pre_oembed_result` ins…
cbravobernal Nov 11, 2026
3664fd1
Block Bindings: Reject supplied inner blocks the bound block doesn't …
cbravobernal Nov 22, 2026
0d3af1a
Block Bindings: Limit how many blocks get inner blocks inside one bou…
cbravobernal Nov 23, 2026
3823482
Block Bindings: Show the supplied inner blocks in automatic excerpts.
cbravobernal Nov 22, 2026
ea65b90
Block Bindings: Test that a rejected value spends no inner blocks bud…
cbravobernal Nov 26, 2026
afbe803
Block Bindings: Count HTML outside blocks as a Classic block in the a…
cbravobernal Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/wp-includes/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function get_block_bindings_source( string $source_name ) {
* @since 6.9.0
* @since 7.1.0 Added support for the List Item block.
* @since 7.2.0 Added support for the Icon block.
* @since 7.3.0 Added support for the inner blocks of the Group and Column blocks.
*
* @param string $block_type The block type whose supported attributes are being retrieved.
* @return array The list of block attributes that are supported by block bindings.
Expand All @@ -153,6 +154,8 @@ function get_block_bindings_supported_attributes( $block_type ) {
'core/navigation-link' => array( 'url' ),
'core/navigation-submenu' => array( 'url' ),
'core/icon' => array( 'icon' ),
'core/group' => array( 'innerBlocks' ),
'core/column' => array( 'innerBlocks' ),
);

$supported_block_attributes =
Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ function wp_get_post_content_block_attributes() {
* Returns the contextualized block editor settings for a selected editor context.
*
* @since 5.8.0
* @since 7.3.0 Leaves `innerBlocks` out of the attributes that block bindings support
* on the Group and Column blocks, as the editor doesn't render its bindings yet.
*
* @param array $custom_settings Custom settings to use with the given editor type.
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
Expand All @@ -503,6 +505,9 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$editor_settings['__experimentalBlockBindingsSupportedAttributes'] = array();
foreach ( array_keys( WP_Block_Type_Registry::get_instance()->get_all_registered() ) as $block_type ) {
$supported_block_attributes = get_block_bindings_supported_attributes( $block_type );
if ( in_array( $block_type, array( 'core/group', 'core/column' ), true ) ) {
$supported_block_attributes = array_values( array_diff( $supported_block_attributes, array( 'innerBlocks' ) ) );
}
if ( ! empty( $supported_block_attributes ) ) {
$editor_settings['__experimentalBlockBindingsSupportedAttributes'][ $block_type ] = $supported_block_attributes;
}
Expand Down
44 changes: 43 additions & 1 deletion src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,7 @@ function filter_block_core_template_part_attributes( $attribute_value, $attribut
* this function renders the blocks that are most likely to contain such text.
*
* @since 5.0.0
* @since 7.3.0 Renders the inner blocks that block bindings supply.
*
* @param string $content The content to parse.
* @return string The parsed and filtered content.
Expand Down Expand Up @@ -2331,6 +2332,11 @@ function excerpt_remove_blocks( $content ) {
}

if ( in_array( $block['blockName'], $allowed_blocks, true ) ) {
if ( isset( $block['attrs']['metadata']['bindings']['innerBlocks'] ) && in_array( 'innerBlocks', get_block_bindings_supported_attributes( $block['blockName'] ), true ) ) {
$output .= _excerpt_render_bound_inner_blocks( $block, $allowed_blocks );
continue;
}

if ( ! empty( $block['innerBlocks'] ) ) {
if ( in_array( $block['blockName'], $allowed_wrapper_blocks, true ) ) {
$output .= _excerpt_render_inner_blocks( $block, $allowed_blocks );
Expand Down Expand Up @@ -2381,6 +2387,7 @@ function excerpt_remove_footnotes( $content ) {
* for generating an excerpt.
*
* @since 5.8.0
* @since 7.3.0 Renders the inner blocks that block bindings supply.
* @access private
*
* @param array $parsed_block The parsed block.
Expand All @@ -2403,7 +2410,9 @@ function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) {
continue;
}

if ( empty( $inner_block['innerBlocks'] ) ) {
if ( isset( $inner_block['attrs']['metadata']['bindings']['innerBlocks'] ) && in_array( 'innerBlocks', get_block_bindings_supported_attributes( $inner_block['blockName'] ), true ) ) {
$output .= _excerpt_render_bound_inner_blocks( $inner_block, $allowed_blocks );
} elseif ( empty( $inner_block['innerBlocks'] ) ) {
$output .= render_block( $inner_block );
} else {
$output .= _excerpt_render_inner_blocks( $inner_block, $allowed_blocks );
Expand All @@ -2413,6 +2422,39 @@ function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) {
return $output;
}

/**
* Renders a block whose inner blocks a block bindings source supplies, for
* generating an excerpt.
*
* The block renders as on the front end, so its binding resolves with the same
* rules, and the blocks the excerpt doesn't allow render nothing.
*
* @since 7.3.0
* @access private
*
* @param array $parsed_block The parsed block.
* @param array $allowed_blocks The list of allowed blocks.
* @return string The rendered block.
*/
function _excerpt_render_bound_inner_blocks( $parsed_block, $allowed_blocks ) {
$skip_disallowed_blocks = static function ( $pre_render, $block ) use ( $allowed_blocks ) {
if (
false === ( $block['attrs']['metadata']['blockVisibility'] ?? null ) ||
! in_array( $block['blockName'], $allowed_blocks, true )
) {
return '';
}
return $pre_render;
};

add_filter( 'pre_render_block', $skip_disallowed_blocks, 10, 2 );
try {
return render_block( $parsed_block );
} finally {
remove_filter( 'pre_render_block', $skip_disallowed_blocks );
}
}

/**
* Renders a single block into a HTML string.
*
Expand Down
Loading
Loading