Make WordPress Core


Ignore:
Timestamp:
08/30/2015 09:44:38 PM (10 years ago)
Author:
obenland
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r33808 r33815  
    691691    $nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
    692692
    693     $old_theme  = wp_get_theme();
     693    if ( func_num_args() > 1 ) {
     694        $stylesheet = func_get_arg( 1 );
     695    }
     696
     697    $old_theme = wp_get_theme();
    694698    $new_theme = wp_get_theme( $stylesheet );
    695 
    696     if ( func_num_args() > 1 ) {
    697         $template = $stylesheet;
    698         $stylesheet = func_get_arg( 1 );
    699     } else {
    700         $template = $new_theme->get_template();
    701     }
     699    $template  = $new_theme->get_template();
    702700
    703701    update_option( 'template', $template );
Note: See TracChangeset for help on using the changeset viewer.