wppaste
WordPress

apply_filters( 'render_block_context', array $context, array $parsed_block, WP_Block|null $parent_block )

Since
5.5.0, 5.9.0
Filters the default context provided to a rendered block.

Compatibility

WordPress
since 5.9.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$contextarray
Default context.
$parsed_blockarray
{ An associative array of the block being rendered. See WP_Block_Parser_Block.
@type string|null $blockName Name of block.
@type array $attrs Attributes from block comment delimiters.
@type array[] $innerBlocks List of inner blocks. An array of arrays that have the same structure as this one.
@type string $innerHTML HTML from inside block comment delimiters.
@type array $innerContent List of string fragments and null markers where inner blocks were found.
}
  • $blockNamestring|null

    Name of block.
  • $attrsarray

    Attributes from block comment delimiters.
  • $innerBlocksarray[]

    List of inner blocks. An array of arrays that have the same structure as this one.
  • $innerHTMLstring

    HTML from inside block comment delimiters.
  • $innerContentarray

    List of string fragments and null markers where inner blocks were found.
$parent_blockWP_Block|null
If this is a nested block, a reference to the parent block.

Where this hook fires · 2

  • wp-includes/blocks.php:2510render_block()
  • wp-includes/class-wp-block.php:617WP_Block::render()

Source code

	 *     @type string      $innerHTML    HTML from inside block comment delimiters.	 *     @type array       $innerContent List of string fragments and null markers where	 *                                     inner blocks were found.	 * }	 * @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.	 */	$context = apply_filters( 'render_block_context', $context, $parsed_block, $parent_block ); 	$block = new WP_Block( $parsed_block, $context ); 	return $block->render();}

Changelog

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.9.0
The $parent_block parameter was added.from the docblock
5.5.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.