render_block_(name)
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. |
Где вызывается хук
render_block_(name)
wp-includes/class-wp-block.php 599
$block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this );
Где используется хук в WordPress
wp-includes/block-supports/block-style-variations.php 253
add_filter( 'render_block_data', 'wp_render_block_style_variation_support_styles', 10, 2 );
wp-includes/block-supports/duotone.php 45
add_filter( 'render_block_core/image', array( 'WP_Duotone', 'restore_image_outer_container' ), 10, 1 );
wp-includes/block-supports/elements.php 264
add_filter( 'render_block_data', 'wp_render_elements_support_styles', 10, 1 );
wp-includes/block-supports/layout.php 1026
add_filter( 'render_block_core/group', 'wp_restore_group_inner_container', 10, 2 );
wp-includes/block-supports/layout.php 1087
add_filter( 'render_block_core/image', 'wp_restore_image_outer_container', 10, 2 );
wp-includes/block-supports/layout.php 945
add_filter( 'render_block_data', 'wp_add_parent_layout_to_parsed_block', 10, 3 );
wp-includes/blocks/block.php 87
add_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/block.php 94
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 35
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
wp-includes/blocks/image.php 83
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
wp-includes/blocks/image.php 88
remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15 );
wp-includes/blocks/latest-posts.php 270
add_filter( 'render_block_data', 'block_core_latest_posts_migrate_categories' );
wp-includes/blocks/navigation.php 1204
add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
wp-includes/blocks/post-template.php 120
add_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/post-template.php 124
remove_filter( 'render_block_context', $filter_block_context, 1 );
wp-includes/blocks/query.php 130
remove_filter( 'render_block_core/query', $render_query_callback );
wp-includes/blocks/query.php 137
add_filter( 'render_block_core/query', $render_query_callback, 10, 2 );
wp-includes/blocks/query.php 152
add_filter( 'render_block_data', 'block_core_query_disable_enhanced_pagination', 10, 1 );
wp-includes/default-filters.php 720
add_filter( 'render_block_context', '_block_template_render_without_post_block_context' );