From 94e4da6aec5bd08acb224da5dcee1efdd1e514ee Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 28 Mar 2019 21:13:54 +0000 Subject: [PATCH] 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 --- wp-includes/general-template.php | 11 +++++++++++ wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 1923c79b48..b225665a3e 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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 ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2c30d8d7ec..fcc6088f5d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.