wppaste
WordPress

apply_filters( 'render_block_data', array $parsed_block, array $source_block, WP_Block|null $parent_block )

Since
5.1.0, 5.9.0
Filters the block being rendered in render_block(), before it's processed.

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

$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.
$source_blockarray
{ An un-modified copy of $parsed_block, as it appeared in the source content.
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:2474render_block()
  • wp-includes/class-wp-block.php:614WP_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.	 */	$parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block ); 	$context = array(); 	if ( $post instanceof WP_Post ) {		$context['postId'] = $post->ID;

Changelog

Introduced in 5.1.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.1.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.