get_block_file_template
Filter HookDescription
Filters the block template object after it has been (potentially) fetched from the theme file.Hook Information
File Location |
wp-includes/block-template-utils.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1386 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Block_Template|null
|
$block_template
|
The found block template, or null if there is none. |
string
|
$id
|
Template unique identifier (example: 'theme_slug//template_slug'). |
string
|
$template_type
|
Template type. Either 'wp_template' or 'wp_template_part'. |
Usage Examples
Basic Usage
<?php
// Hook into get_block_file_template
add_filter('get_block_file_template', 'my_custom_filter', 10, 3);
function my_custom_filter($block_template, $id, $template_type) {
// Your custom filtering logic here
return $block_template;
}
Source Code Context
wp-includes/block-template-utils.php:1386
- How this hook is used in WordPress core
<?php
1381 *
1382 * @param WP_Block_Template|null $block_template The found block template, or null if there is none.
1383 * @param string $id Template unique identifier (example: 'theme_slug//template_slug').
1384 * @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
1385 */
1386 return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
1387 }
1388
1389 /**
1390 * Prints a block template part.
1391 *
PHP Documentation
<?php
/**
* Filters the block template object after it has been (potentially) fetched from the theme file.
*
* @since 5.9.0
*
* @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. Either 'wp_template' or 'wp_template_part'.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/block-template-utils.php
Related Hooks
Related hooks will be displayed here in future updates.