From 88d961937e2edb75565e6bb00259097a8d69d9b5 Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 4 Dec 2010 04:31:55 +0000 Subject: [PATCH] Always land on style.css by default, rather than whichever stylesheet came first in the directory scan. Prevents useless trips to editor-style-rtl.css and the like. see #15672. git-svn-id: http://svn.automattic.com/wordpress/trunk@16718 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/theme-editor.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index b7300b71a..064c470e0 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 ) {