From d2f20909cafcc0a24fc09b96b9a899e2f72f9db7 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Wed, 17 Jun 2026 14:30:10 +0200 Subject: [PATCH] Block Bindings: Enable native List Item content binding. Add `core/list-item` to the block attributes supported by block bindings so its `content` rich text can be bound, and cover the basic case in the render tests. Note: a List Item that contains a nested List keeps both in the same `
  • `; preserving that nested list when the content is bound is handled separately by the WP_Block::replace_html() inner-block fix. Props sauliusv, cbravobernal. See https://core.trac.wordpress.org/ticket/65406 --- src/wp-includes/block-bindings.php | 2 ++ tests/phpunit/tests/block-bindings/render.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/wp-includes/block-bindings.php b/src/wp-includes/block-bindings.php index 268bb6afa66bb..5a20c023149d7 100644 --- a/src/wp-includes/block-bindings.php +++ b/src/wp-includes/block-bindings.php @@ -134,6 +134,7 @@ function get_block_bindings_source( string $source_name ) { * Retrieves the list of block attributes supported by block bindings. * * @since 6.9.0 + * @since 7.1.0 Added support for the List Item block. * * @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. @@ -142,6 +143,7 @@ function get_block_bindings_supported_attributes( $block_type ) { $block_bindings_supported_attributes = array( 'core/paragraph' => array( 'content' ), 'core/heading' => array( 'content' ), + 'core/list-item' => array( 'content' ), 'core/image' => array( 'id', 'url', 'title', 'alt', 'caption' ), 'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ), 'core/post-date' => array( 'datetime' ), diff --git a/tests/phpunit/tests/block-bindings/render.php b/tests/phpunit/tests/block-bindings/render.php index 77b0975105dc5..172bdff71315d 100644 --- a/tests/phpunit/tests/block-bindings/render.php +++ b/tests/phpunit/tests/block-bindings/render.php @@ -122,6 +122,16 @@ public function data_update_block_with_value_from_source() { , '

    test source value

    ', ), + 'list item block' => array( + 'content', + << +
  • This should not appear
  • + +HTML + , + '
  • test source value
  • ', + ), ); }