hooked_block
Filters the parsed block array for a given hooked block.
Usage
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(array|null)
- The parsed block array for the given hooked block type, or null to suppress the block.
- $hooked_block_type(string)
- The hooked block type name.
- $relative_position(string)
- The relative position of the hooked block.
- $parsed_anchor_block(array)
- The anchor block, in parsed block array format.
- $context(WP_Block_Template|WP_Post|array)
- The block template, template part, post object, or pattern that the anchor block belongs to.
Changelog
| Since 6.5.0 | Introduced. |
Where the hook is called
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 );