From 34898422b6fdc2cebc71977a3ef05267d1616e7f Mon Sep 17 00:00:00 2001 From: Eric Andrew Lewis Date: Sun, 17 Jan 2016 17:28:50 +0000 Subject: [PATCH] Themes: Show an error message to logged-in users if a template file isn't loaded. On the off-chance the active theme folder is renamed or deleted, a "white screen of death" was displayed to the user. Instead, the user is shown a useful error screen displaying any errors the theme has (e.g. if the theme can't be found). Props MikeHansenMe, SergeyBiryukov. See #21931. git-svn-id: https://develop.svn.wordpress.org/trunk@36335 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/template-loader.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/template-loader.php b/src/wp-includes/template-loader.php index 297b9704ff..57f1db1ce0 100644 --- a/src/wp-includes/template-loader.php +++ b/src/wp-includes/template-loader.php @@ -84,7 +84,13 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : * * @param string $template The path of the template to include. */ - if ( $template = apply_filters( 'template_include', $template ) ) + if ( $template = apply_filters( 'template_include', $template ) ) { include( $template ); + } elseif ( is_user_logged_in() ) { + $theme = wp_get_theme(); + if ( $theme->errors() ) { + wp_die( $theme->errors() ); + } + } return; endif;