hooked_block_types filter-hookWP 6.4.0

Filters the list of hooked block types for a given anchor block type and relative position.

Usage

add_filter( 'hooked_block_types', 'wp_kama_hooked_block_types_filter', 10, 4 );

/**
 * Function for `hooked_block_types` filter-hook.
 * 
 * @param string[]                        $hooked_block_types The list of hooked block types.
 * @param string                          $relative_position  The relative position of the hooked blocks. Can be one of 'before', 'after', 'first_child', or 'last_child'.
 * @param string                          $anchor_block_type  The anchor block type.
 * @param WP_Block_Template|WP_Post|array $context            The block template, template part, `wp_navigation` post type, or pattern that the anchor block belongs to.
 *
 * @return string[]
 */
function wp_kama_hooked_block_types_filter( $hooked_block_types, $relative_position, $anchor_block_type, $context ){

	// filter...
	return $hooked_block_types;
}
$hooked_block_types(string[])
The list of hooked block types.
$relative_position(string)
The relative position of the hooked blocks. Can be one of 'before', 'after', 'first_child', or 'last_child'.
$anchor_block_type(string)
The anchor block type.
$context(WP_Block_Template|WP_Post|array)
The block template, template part, wp_navigation post type, or pattern that the anchor block belongs to.

Changelog

Since 6.4.0 Introduced.

Where the hook is called

insert_hooked_blocks()
hooked_block_types
set_ignored_hooked_blocks_metadata()
hooked_block_types
wp-includes/blocks.php 886
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
wp-includes/blocks.php 966
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );

Where the hook is used in WordPress

Usage not found.