From 56467f798c61a908e61ce52db431aa90b9037856 Mon Sep 17 00:00:00 2001 From: Marian <42134098+IanDelMar@users.noreply.github.com> Date: Mon, 2 Feb 2026 03:20:47 +0100 Subject: [PATCH] Ensure `WP_Theme::$template` is not null --- src/wp-includes/class-wp-theme.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index a6966351f185f..da591e7def500 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -361,7 +361,7 @@ public function __construct( $theme_dir, $theme_root, $_child = null ) { } if ( ! $this->template && $this->stylesheet === $this->headers['Template'] ) { - $this->errors = new WP_Error( + $this->errors = new WP_Error( 'theme_child_invalid', sprintf( /* translators: %s: Template. */ @@ -369,6 +369,7 @@ public function __construct( $theme_dir, $theme_root, $_child = null ) { 'Template' ) ); + $this->template = $this->stylesheet; $this->cache_add( 'theme', array( @@ -377,6 +378,7 @@ public function __construct( $theme_dir, $theme_root, $_child = null ) { 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, + 'template' => $this->template, ) );