get_block_templates
Filters the array of queried block templates array after they've been fetched.
Использование
add_filter( 'get_block_templates', 'wp_kama_get_block_templates_filter', 10, 3 ); /** * Function for `get_block_templates` filter-hook. * * @param WP_Block_Template[] $query_result Array of found block templates. * @param array $query Optional. Arguments to retrieve templates. * @param string $template_type wp_template or wp_template_part. * * @return WP_Block_Template[] */ function wp_kama_get_block_templates_filter( $query_result, $query, $template_type ){ // filter... return $query_result; }
- $query_result(WP_Block_Template[])
- Array of found block templates.
- $query(массив)
Optional. Arguments to retrieve templates.
-
slug__in(массив)
List of slugs to include. - wp_id(int)
Post ID of customized template.
-
- $template_type(строка)
- wp_template or wp_template_part.
Список изменений
С версии 5.9.0 | Введена. |
Где вызывается хук
get_block_templates
wp-includes/block-template-utils.php 1001
return apply_filters( 'get_block_templates', $query_result, $query, $template_type );