Internally cache themes inside wp_get_themes() by theme_root as well as stylesheet, to avoid conflicts with future calls to wp_get_themes(). Always return only the last stylesheet found, as before. see #20103.

git-svn-id: https://develop.svn.wordpress.org/trunk@20375 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-04-05 20:38:42 +00:00
parent 596c72cafa
commit 6e3ed8bbf9
1 changed files with 5 additions and 3 deletions

View File

@ -63,10 +63,10 @@ function wp_get_themes( $args = array() ) {
static $_themes = array();
foreach ( $theme_directories as $theme => $theme_root ) {
if ( isset( $_themes[ $theme ] ) )
$themes[ $theme ] = $_themes[ $theme ];
if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
else
$themes[ $theme ] = $_themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
}
if ( null !== $args['errors'] ) {
@ -325,6 +325,8 @@ function search_theme_directories( $force = false ) {
$found_themes = array();
$wp_theme_directories = (array) $wp_theme_directories;
// Set up maybe-relative, maybe-absolute array of theme directories.
// We always want to return absolute, but we need to cache relative
// use in for get_theme_root().