Themes: Introduce a generic action that's fired when a template part is loaded.

This action allows debugging mechanisms to perform greater introspection into which template parts are loaded for any given request. It also exposes the array of candidate template part file names for each template part instance.

Props pcfreak30, jdeeburke

Fixes #41575

Built from https://develop.svn.wordpress.org/trunk@45059


git-svn-id: http://core.svn.wordpress.org/trunk@44868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2019-03-28 21:13:54 +00:00
parent 9ca5ec97b1
commit 94e4da6aec
2 changed files with 12 additions and 1 deletions

View File

@ -154,6 +154,17 @@ function get_template_part( $slug, $name = null ) {
$templates[] = "{$slug}.php";
/**
* Fires before a template part is loaded.
*
* @since 5.2.0
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialized template.
* @param string[] $templates Array of template files to search for, in order.
*/
do_action( 'get_template_part', $slug, $name, $templates );
locate_template( $templates, true, false );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta1-45058';
$wp_version = '5.2-beta1-45059';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.