hooked_block_types
Filters the list of hooked block types for a given anchor block type and relative position.
Использование
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(строка)
- The relative position of the hooked blocks. Can be one of 'before', 'after', 'first_child', or 'last_child'.
- $anchor_block_type(строка)
- The anchor block type.
- $context(WP_Block_Template|WP_Post|массив)
- The block template, template part, wp_navigation post type, or pattern that the anchor block belongs to.
Список изменений
С версии 6.4.0 | Введена. |
Где вызывается хук
wp-includes/blocks.php 918
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
wp-includes/blocks.php 998
$hooked_block_types = apply_filters( 'hooked_block_types', $hooked_block_types, $relative_position, $anchor_block_type, $context );
Где используется хук в WordPress
wp-includes/blocks.php 1124
add_filter( 'hooked_block_types', $suppress_single_instance_blocks, PHP_INT_MAX );
wp-includes/blocks.php 1130
remove_filter( 'hooked_block_types', $suppress_single_instance_blocks, PHP_INT_MAX );