Upgrade: New themes are not automatically installed on upgrade. This can still be explicitly asked for by defining CORE_UPGRADE_SKIP_NEW_BUNDLED as false.

In `populate_options()`, if the theme specified by `WP_DEFAULT_THEME` doesn't exist, fall back to the latest core default theme. If we can't find a core default theme, `WP_DEFAULT_THEME` is the best we can do. 

Props nacin, jeremyfelt, dd32.
See #34306.


git-svn-id: https://develop.svn.wordpress.org/trunk@35738 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-11-25 21:44:02 +00:00
parent 2be61281f0
commit 663b7f28ff
6 changed files with 86 additions and 20 deletions

View File

@@ -56,6 +56,7 @@ final class WP_Theme implements ArrayAccess {
'twentythirteen' => 'Twenty Thirteen',
'twentyfourteen' => 'Twenty Fourteen',
'twentyfifteen' => 'Twenty Fifteen',
'twentysixteen' => 'Twenty Sixteen',
);
/**
@@ -1150,6 +1151,23 @@ final class WP_Theme implements ArrayAccess {
return false;
}
/**
* Determines the latest WordPress default theme that is installed.
*
* This hits the filesystem.
*
* @return WP_Theme|false Object, or false if no theme is installed, which would be bad.
*/
public static function get_core_default_theme() {
foreach ( array_reverse( self::$default_themes ) as $slug => $name ) {
$theme = wp_get_theme( $slug );
if ( $theme->exists() ) {
return $theme;
}
}
return false;
}
/**
* Returns array of stylesheet names of themes allowed on the site or network.
*