do_action( 'get_template_part', string $slug, string $name, string[] $templates, array $args )
- Since
- 5.2.0, 5.5.0
Fires before an attempt is made to locate and load a template part.
Compatibility
- WordPress
- since 5.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$slugstring- The slug name for the generic template.
$namestring- The name of the specialized template or an empty string if there is none.
$templatesstring[]- Array of template files to search for, in order.
$argsarray- Additional arguments passed to the template.
Where this hook fires · 1
wp-includes/general-template.php:204get_template_part()
Source code
* @param string $slug The slug name for the generic template. * @param string $name The name of the specialized template * or an empty string if there is none. * @param string[] $templates Array of template files to search for, in order. * @param array $args Additional arguments passed to the template. */ do_action( 'get_template_part', $slug, $name, $templates, $args ); if ( ! locate_template( $templates, true, false, $args ) ) { return false; }}Changelog
Introduced in 5.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.5.0
The
$args parameter was added.from the docblock5.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.