From 8fb284ba0e604060e43fd82d39ecf71202005d0a Mon Sep 17 00:00:00 2001 From: Herb Miller Date: Fri, 28 May 2021 12:26:25 +0100 Subject: [PATCH] Add rendering_template action (#32309) --- lib/full-site-editing/template-loader.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/full-site-editing/template-loader.php b/lib/full-site-editing/template-loader.php index 69b586bca1b26..d0b51e12a557f 100644 --- a/lib/full-site-editing/template-loader.php +++ b/lib/full-site-editing/template-loader.php @@ -58,6 +58,18 @@ function gutenberg_override_query_template( $template, $type, array $templates ) $block_template = gutenberg_resolve_template( $type, $templates ); + /** + * Fires before the template is rendered. + * + * Allows extensions to follow template processing. + * Called before the template is rendered. + * + * @param object $current_template The current template object. + * @param string $type Sanitized filename without extension. + * @param array $templates A list of template candidates, in descending order of priority. + */ + do_action( 'rendering_template', $block_template, $type, $templates ); + if ( $block_template ) { if ( empty( $block_template->content ) && is_user_logged_in() ) { $_wp_current_template_content =