get_template_part action-hookWP 5.2.0

Fires before an attempt is made to locate and load a template part.

Usage

add_action( 'get_template_part', 'wp_kama_get_template_part_action', 10, 4 );

/**
 * Function for `get_template_part` action-hook.
 * 
 * @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.
 *
 * @return void
 */
function wp_kama_get_template_part_action( $slug, $name, $templates, $args ){

	// action...
}
$slug(string)
The slug name for the generic template.
$name(string)
The name of the specialized template or an empty string if there is none.
$templates(string[])
Array of template files to search for, in order.
$args(array)
Additional arguments passed to the template.

Changelog

Since 5.2.0 Introduced.
Since 5.5.0 The $args parameter was added.

Where the hook is called

get_template_part()
get_template_part
wp-includes/general-template.php 204
do_action( 'get_template_part', $slug, $name, $templates, $args );

Where the hook is used in WordPress

Usage not found.