Make WordPress Core

Changeset 36335


Ignore:
Timestamp:
01/17/2016 05:28:50 PM (11 years ago)
Author:
ericlewis
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/template-loader.php

    r35848 r36335  
    8585         * @param string $template The path of the template to include.
    8686         */
    87         if ( $template = apply_filters( 'template_include', $template ) )
     87        if ( $template = apply_filters( 'template_include', $template ) ) {
    8888                include( $template );
     89        } elseif ( is_user_logged_in() ) {
     90                $theme = wp_get_theme();
     91                if ( $theme->errors() ) {
     92                        wp_die( $theme->errors() );
     93                }
     94        }
    8995        return;
    9096endif;
Note: See TracChangeset for help on using the changeset viewer.