render_block_data
Filters the block being rendered in render_block(), before it's processed.
Использование
add_filter( 'render_block_data', 'wp_kama_render_block_data_filter', 10, 3 ); /** * Function for `render_block_data` filter-hook. * * @param array $parsed_block An associative array of the block being rendered. See WP_Block_Parser_Block. * @param array $source_block An un-modified copy of `$parsed_block`, as it appeared in the source content. See WP_Block_Parser_Block. * @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(массив)
An associative array of the block being rendered. See WP_Block_Parser_Block.
-
blockName(строка)
Name of block. -
attrs(массив)
Attributes from block comment delimiters. -
innerBlocks(array[])
List of inner blocks. An array of arrays that have the same structure as this one. -
innerHTML(строка)
HTML from inside block comment delimiters. - innerContent(массив)
List of string fragments and null markers where inner blocks were found.
-
- $source_block(массив)
An un-modified copy of $parsed_block, as it appeared in the source content. See WP_Block_Parser_Block.
-
blockName(строка)
Name of block. -
attrs(массив)
Attributes from block comment delimiters. -
innerBlocks(array[])
List of inner blocks. An array of arrays that have the same structure as this one. -
innerHTML(строка)
HTML from inside block comment delimiters. - innerContent(массив)
List of string fragments and null markers where inner blocks were found.
-
- $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. |
Где вызывается хук
$parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block );
$inner_block->parsed_block = apply_filters( 'render_block_data', $inner_block->parsed_block, $source_block, $parent_block );
Где используется хук в WordPress
add_filter( 'render_block_data', 'wp_render_block_style_variation_support_styles', 10, 2 );
add_filter( 'render_block_data', 'wp_render_elements_support_styles', 10, 1 );
add_filter( 'render_block_data', 'wp_add_parent_layout_to_parsed_block', 10, 3 );
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' );
add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
add_filter( 'render_block_data', 'block_core_query_disable_enhanced_pagination', 10, 1 );