Skip to content

Commit

Permalink
Update available context in helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshpanchal27 authored Nov 11, 2024
1 parent 210298f commit 4096831
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 4096831

Please sign in to comment.