diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index b7300b71a2..064c470e09 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -44,10 +44,13 @@ if (empty($theme)) { if ( ! isset($themes[$theme]) ) wp_die(__('The requested theme does not exist.')); -$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']); +$allowed_files = array_merge( $themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files'] ); -if (empty($file)) { - $file = $allowed_files[0]; +if ( empty( $file ) ) { + if ( false !== array_search( $themes[$theme]['Stylesheet Dir'] . '/style.css', $allowed_files ) ) + $file = $themes[$theme]['Stylesheet Dir'] . '/style.css'; + else + $file = $allowed_files[0]; } else { $file = stripslashes($file); if ( 'theme' == $dir ) {