Themes: Only users with proper capability should see theme errors.

After [36335], if a template file is not loaded, an error is displayed
to logged-in users. As logged-in users may have no capabilities,
this check is insubstantial. Limit the display of this error to users
with the `install_themes` capability, i.e. someone who has the capacity
to deal with the error.

See #21931.


git-svn-id: https://develop.svn.wordpress.org/trunk@36338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Eric Andrew Lewis 2016-01-17 23:58:04 +00:00
parent 342d132b37
commit 7c6c3a081f

View File

@ -86,7 +86,7 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
*/
if ( $template = apply_filters( 'template_include', $template ) ) {
include( $template );
} elseif ( is_user_logged_in() ) {
} elseif ( current_user_can( 'install_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );