hooked_block
Filters the parsed block array for a given hooked block.
Использование
add_filter( 'hooked_block', 'wp_kama_hooked_block_filter', 10, 5 );
/**
* Function for `hooked_block` filter-hook.
*
* @param array|null $parsed_hooked_block The parsed block array for the given hooked block type, or null to suppress the block.
* @param string $hooked_block_type The hooked block type name.
* @param string $relative_position The relative position of the hooked block.
* @param array $parsed_anchor_block The anchor block, in parsed block array format.
* @param WP_Block_Template|WP_Post|array $context The block template, template part, post object, or pattern that the anchor block belongs to.
*
* @return array|null
*/
function wp_kama_hooked_block_filter( $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context ){
// filter...
return $parsed_hooked_block;
}
- $parsed_hooked_block(массив|null)
- The parsed block array for the given hooked block type, or null to suppress the block.
- $hooked_block_type(строка)
- The hooked block type name.
- $relative_position(строка)
- The relative position of the hooked block.
- $parsed_anchor_block(массив)
- The anchor block, in parsed block array format.
- $context(WP_Block_Template|WP_Post|массив)
- The block template, template part, post object, or pattern that the anchor block belongs to.
Список изменений
| С версии 6.5.0 | Введена. |
Где вызывается хук
wp-includes/blocks.php 990
$parsed_hooked_block = apply_filters( 'hooked_block', $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
wp-includes/blocks.php 1061
$parsed_hooked_block = apply_filters( 'hooked_block', $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );