WordPress action hook · part of WordPress core
render_block_core_template_part_file
A WordPress core action that 4 plugins also fire themselves, running on 431K+ sites between them.
“Fires when a block template part is loaded from a template part in the theme.”
How to use render_block_core_template_part_file
It's an action: your callback runs at that point and receives 4 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'render_block_core_template_part_file', function( $template_part_id, $attributes, $template_part_file_path, $content ) {
// Your code runs here.
}, 10, 4 );Argument names come from Gutenberg's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
4 plugins that fire render_block_core_template_part_file
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Gutenberg400,000+ installs
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content )build/scripts/block-library/template-part.php:111 -
Gutenverse20,000+ installs
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content )lib/framework/helper.php:1700 -
Gutenverse Form10,000+ installs
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content )lib/framework/helper.php:1700 -
Gutenverse News700+ installs
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content )lib/framework/helper.php:1485
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.