hooked_block_(hooked_block_type) хук-фильтрWP 6.5.0

Filters the parsed block array for a given hooked block.

The dynamic portion of the hook name, $hooked_block_type, refers to the block type name of the specific hooked block.

Использование

add_filter( 'hooked_block_(hooked_block_type)', 'wp_kama_hooked_block_type_filter', 10, 5 );

/**
 * Function for `hooked_block_(hooked_block_type)` 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, `wp_navigation` post type, or pattern that the anchor block belongs to.
 *
 * @return array|null
 */
function wp_kama_hooked_block_type_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, wp_navigation post type, or pattern that the anchor block belongs to.

Список изменений

С версии 6.5.0 Введена.

Где вызывается хук

insert_hooked_blocks()
hooked_block_(hooked_block_type)
set_ignored_hooked_blocks_metadata()
hooked_block_(hooked_block_type)
wp-includes/blocks.php 957
$parsed_hooked_block = apply_filters( "hooked_block_{$hooked_block_type}", $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
wp-includes/blocks.php 1015
$parsed_hooked_block = apply_filters( "hooked_block_{$hooked_block_type}", $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $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 );