diff --git a/src/wp-includes/class-wp-block-bindings-registry.php b/src/wp-includes/class-wp-block-bindings-registry.php index 1f0ae95f82b73..14ba4d110fd9f 100644 --- a/src/wp-includes/class-wp-block-bindings-registry.php +++ b/src/wp-includes/class-wp-block-bindings-registry.php @@ -33,12 +33,12 @@ final class WP_Block_Bindings_Registry { private static $instance = null; /** - * Allowed block that can use the block bindings API. + * Supported blocks that can use the block bindings API. * * @since 6.5.0 * @var WP_Block_Bindings_Registry[] */ - public $allowed_blocks = array( + private $supported_blocks = array( 'core/paragraph' => array( 'content' ), 'core/heading' => array( 'content' ), 'core/image' => array( 'url', 'title', 'alt' ), @@ -162,8 +162,7 @@ public function register( string $source_name, array $source_properties ) { add_filter( 'get_block_type_uses_context', function ( $uses_context, $block_type ) use ( $source ) { - $allowed_blocks = $this->allowed_blocks; - if ( empty( $allowed_blocks[ $block_type->name ] ) || empty( $source->uses_context ) ) { + if ( empty( $this->supported_blocks[ $block_type->name ] ) || empty( $source->uses_context ) ) { return $uses_context; } // Use array_values to reset the array keys. diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php index dcdefb3bead0b..b646adb88d0ad 100644 --- a/src/wp-includes/class-wp-block.php +++ b/src/wp-includes/class-wp-block.php @@ -235,12 +235,17 @@ private function process_block_bindings() { $computed_attributes = array(); - $allowed_blocks = WP_Block_Bindings_Registry::get_instance()->allowed_blocks; + $supported_blocks = array( + 'core/paragraph' => array( 'content' ), + 'core/heading' => array( 'content' ), + 'core/image' => array( 'url', 'title', 'alt' ), + 'core/button' => array( 'url', 'text', 'linkTarget', 'rel' ), + ); - // If the block doesn't have the bindings property, isn't one of the allowed + // If the block doesn't have the bindings property, isn't one of the supported // block types, or the bindings property is not an array, return the block content. if ( - ! isset( $allowed_blocks[ $this->name ] ) || + ! isset( $supported_blocks[ $this->name ] ) || empty( $parsed_block['attrs']['metadata']['bindings'] ) || ! is_array( $parsed_block['attrs']['metadata']['bindings'] ) ) { @@ -248,8 +253,8 @@ private function process_block_bindings() { } foreach ( $parsed_block['attrs']['metadata']['bindings'] as $attribute_name => $block_binding ) { - // If the attribute is not in the allowed list, process next attribute. - if ( ! in_array( $attribute_name, $allowed_blocks[ $this->name ], true ) ) { + // If the attribute is not in the supported list, process next attribute. + if ( ! in_array( $attribute_name, $supported_blocks[ $this->name ], true ) ) { continue; } // If no source is provided, or that source is not registered, process next attribute.