render_block_data хук-фильтрWP 5.1.0

Использование

add_filter( 'render_block_data', 'wp_kama_render_block_data_filter', 10, 3 );

/**
 * Function for `render_block_data` filter-hook.
 * 
 * @param array         $parsed_block The block being rendered.
 * @param array         $source_block An un-modified copy of $parsed_block, as it appeared in the source content.
 * @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
 *
 * @return array
 */
function wp_kama_render_block_data_filter( $parsed_block, $source_block, $parent_block ){

	// filter...
	return $parsed_block;
}
$parsed_block(массив)
The block being rendered.
$source_block(массив)
An un-modified copy of $parsed_block, as it appeared in the source content.
$parent_block(WP_Block|null)
If this is a nested block, a reference to the parent block.

Список изменений

С версии 5.1.0 Введена.
С версии 5.9.0 The $parent_block parameter was added.

Где вызывается хук

render_block()
render_block_data
WP_Block::render()
render_block_data
wp-includes/blocks.php 1021
$parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block );
wp-includes/class-wp-block.php 237
$inner_block->parsed_block = apply_filters( 'render_block_data', $inner_block->parsed_block, $source_block, $parent_block );

Где используется хук в WordPress

wp-includes/blocks/gallery.php 33
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
wp-includes/blocks/latest-posts.php 245
add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' );
wp-includes/blocks/navigation.php 711
add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );