render_block_(name) хук-фильтрWP 5.7.0

Filters the content of a single block.

The dynamic portion of the hook name, $name, refers to the block name, e.g. "core/paragraph".

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

add_filter( 'render_block_(name)', 'wp_kama_render_block_name_filter', 10, 3 );

/**
 * Function for `render_block_(name)` filter-hook.
 * 
 * @param string   $block_content The block content.
 * @param array    $block         The full block, including name and attributes.
 * @param WP_Block $instance      The block instance.
 *
 * @return string
 */
function wp_kama_render_block_name_filter( $block_content, $block, $instance ){

	// filter...
	return $block_content;
}
$block_content(строка)
The block content.
$block(массив)
The full block, including name and attributes.
$instance(WP_Block)
The block instance.

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

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

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

WP_Block::render()
render_block_(name)
wp-includes/class-wp-block.php 525
$block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this );

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

wp-includes/block-supports/layout.php 932
add_filter( 'render_block_core/group', 'wp_restore_group_inner_container', 10, 2 );
wp-includes/block-supports/layout.php 993
add_filter( 'render_block_core/image', 'wp_restore_image_outer_container', 10, 2 );
wp-includes/blocks/block.php 83
add_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/block.php 90
remove_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/comment-template.php 44
add_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/comment-template.php 52
remove_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/gallery.php 33
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
wp-includes/blocks/image.php 72
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
wp-includes/blocks/image.php 77
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
wp-includes/blocks/latest-posts.php 261
add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' );
wp-includes/blocks/navigation.php 1138
add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
wp-includes/blocks/post-template.php 116
add_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/post-template.php 120
remove_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/query.php 148
remove_filter( 'render_block_core/query', $render_query_callback );
wp-includes/blocks/query.php 155
add_filter( 'render_block_core/query', $render_query_callback, 10, 2 );
wp-includes/blocks/query.php 170
add_filter( 'render_block_data', 'block_core_query_disable_enhanced_pagination', 10, 1 );
wp-includes/default-filters.php 717
add_filter( 'render_block_context', '_block_template_render_without_post_block_context' );
wp-includes/interactivity-api/interactivity-api.php 53
remove_filter( 'render_block_' . $parsed_block['blockName'], $process_interactive_blocks );
wp-includes/interactivity-api/interactivity-api.php 73
add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks', 100, 1 );