get_block_file_template filter-hookWP 5.9.0

Filters the block template object after it has been (potentially) fetched from the theme file.


add_filter( 'get_block_file_template', 'wp_kama_get_block_file_template_filter', 10, 3 );

 * Function for `get_block_file_template` filter-hook.
 * @param WP_Block_Template|null $block_template The found block template, or null if there is none.
 * @param string                 $id             Template unique identifier (example: theme_slug//template_slug).
 * @param string                 $template_type  Template type: `'wp_template'` or '`wp_template_part'`.
 * @return WP_Block_Template|null
function wp_kama_get_block_file_template_filter( $block_template, $id, $template_type ){

	// filter...
	return $block_template;
The found block template, or null if there is none.
Template unique identifier (example: theme_slug//template_slug).
Template type: 'wp_template' or 'wp_template_part'.


Since 5.9.0 Introduced.

Where the hook is called

wp-includes/block-template-utils.php 1135
return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
wp-includes/block-template-utils.php 1109
return apply_filters( 'get_block_file_template', null, $id, $template_type );
wp-includes/block-template-utils.php 1115
return apply_filters( 'get_block_file_template', null, $id, $template_type );
wp-includes/block-template-utils.php 1121
return apply_filters( 'get_block_file_template', null, $id, $template_type );

Where the hook is used in WordPress

Usage not found.