From 5dd1936fdb15c50048884edfbbc143a9825b784f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 23 Jun 2022 18:59:09 +0000 Subject: [PATCH] Themes: Add actions to template loading to assist with collecting debug info. This introduces the following new actions which wrap the process of loading a template file: * `wp_before_load_template` * `wp_after_load_template` Props rmccue, tabrisrp, peterwilsoncc Fixes #54541 Built from https://develop.svn.wordpress.org/trunk@53560 git-svn-id: http://core.svn.wordpress.org/trunk@53149 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template.php | 24 ++++++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/wp-includes/template.php b/wp-includes/template.php index 891e77748d..60752349c0 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -713,7 +713,31 @@ function locate_template( $template_names, $load = false, $require_once = true, } if ( $load && '' !== $located ) { + /** + * Fires before a located template is loaded. + * + * @since 6.1.0 + * + * @param string $located The template filename. + * @param string|array $template_names Template file(s) to search for, in order. + * @param bool $require_once Whether to require_once or require. + * @param array $args Additional arguments passed to the template. + */ + do_action( 'wp_before_load_template', $located, $template_names, $require_once, $args ); + load_template( $located, $require_once, $args ); + + /** + * Fires after a located template is loaded. + * + * @since 6.1.0 + * + * @param string $located The template filename. + * @param string|array $template_names Template file(s) to search for, in order. + * @param bool $require_once Whether to require_once or require. + * @param array $args Additional arguments passed to the template. + */ + do_action( 'wp_after_load_template', $located, $template_names, $require_once, $args ); } return $located; diff --git a/wp-includes/version.php b/wp-includes/version.php index 026339c48a..37afa48085 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53559'; +$wp_version = '6.1-alpha-53560'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.