Themes: Get the correct theme when template and stylesheet were both passed as arguments.

Fixes a bug where `$new_theme` got set before the second argument was
appropriately handled, causing the `current_theme` option to later always be
updated to the parent theme's name.

Introduced in [21131].

Props obenland, wonderboymusic.
Fixes #32635.


Built from https://develop.svn.wordpress.org/trunk@33815


git-svn-id: http://core.svn.wordpress.org/trunk@33783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2015-08-30 21:45:23 +00:00
parent b35b167cfc
commit 1e9372b699
2 changed files with 5 additions and 7 deletions

View File

@ -690,16 +690,14 @@ function switch_theme( $stylesheet ) {
$nav_menu_locations = get_theme_mod( 'nav_menu_locations' ); $nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
$old_theme = wp_get_theme();
$new_theme = wp_get_theme( $stylesheet );
if ( func_num_args() > 1 ) { if ( func_num_args() > 1 ) {
$template = $stylesheet;
$stylesheet = func_get_arg( 1 ); $stylesheet = func_get_arg( 1 );
} else {
$template = $new_theme->get_template();
} }
$old_theme = wp_get_theme();
$new_theme = wp_get_theme( $stylesheet );
$template = $new_theme->get_template();
update_option( 'template', $template ); update_option( 'template', $template );
update_option( 'stylesheet', $stylesheet ); update_option( 'stylesheet', $stylesheet );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33814'; $wp_version = '4.4-alpha-33815';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.