render_block_core_template_part_file
Action HookDescription
Fires when a block template part is loaded from a template part in the theme.Hook Information
File Location |
wp-includes/blocks/template-part.php
View on GitHub
|
Hook Type | Action |
Line Number | 98 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$template_part_id
|
The requested template part namespaced to the theme. |
array
|
$attributes
|
The block attributes. |
string
|
$template_part_file_path
|
Absolute path to the template path. |
string
|
$content
|
The template part content. |
Usage Examples
Basic Usage
<?php
// Hook into render_block_core_template_part_file
add_action('render_block_core_template_part_file', 'my_custom_function', 10, 4);
function my_custom_function($template_part_id, $attributes, $template_part_file_path, $content) {
// Your custom code here
}
Source Code Context
wp-includes/blocks/template-part.php:98
- How this hook is used in WordPress core
<?php
93 * @param string $template_part_id The requested template part namespaced to the theme.
94 * @param array $attributes The block attributes.
95 * @param string $template_part_file_path Absolute path to the template path.
96 * @param string $content The template part content.
97 */
98 do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content );
99 } else {
100 /**
101 * Fires when a requested block template part does not exist in the database nor in the theme.
102 *
103 * @since 5.9.0
PHP Documentation
<?php
/**
* Fires when a block template part is loaded from a template part in the theme.
*
* @since 5.9.0
*
* @param string $template_part_id The requested template part namespaced to the theme.
* @param array $attributes The block attributes.
* @param string $template_part_file_path Absolute path to the template path.
* @param string $content The template part content.
*/
Quick Info
- Hook Type: Action
- Parameters: 4
- File: wp-includes/blocks/template-part.php
Related Hooks
Related hooks will be displayed here in future updates.