From 4096831e6f690e1bdab1b5fde7fc661f0c1994af Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 11 Nov 2024 14:54:04 +0530 Subject: [PATCH] Update available context in helper function --- src/wp-includes/class-wp-block.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php index bb30b0a893f16..d608cc49c5d99 100644 --- a/src/wp-includes/class-wp-block.php +++ b/src/wp-includes/class-wp-block.php @@ -156,6 +156,8 @@ public function __construct( $block, $available_context = array(), $registry = n * @since 6.8.0 */ public function refresh_context_dependents() { + $this->available_context = array_merge( $this->available_context, $this->context ); + if ( ! empty( $this->block_type->uses_context ) ) { foreach ( $this->block_type->uses_context as $context_name ) { if ( array_key_exists( $context_name, $this->available_context ) ) { @@ -546,7 +548,6 @@ public function render( $options = array() ) { $inner_block->context = apply_filters( 'render_block_context', $inner_block->context, $inner_block->parsed_block, $parent_block ); if ( $inner_block->context !== $inner_block_context ) { - $inner_block->available_context = array_merge( $this->available_context, $inner_block->context ); $inner_block->refresh_context_dependents(); }