WordPress.org

Make WordPress Core

Ticket #15648: switch_theme.15648.patch

File switch_theme.15648.patch, 791 bytes (added by drzraf, 3 years ago)

switch theme hook now provide both old and new templates and stylesheet used

  • wp-includes/theme.php

     
    12461246function switch_theme($template, $stylesheet) { 
    12471247        global $wp_theme_directories; 
    12481248 
     1249        $old_template = get_option('template'); 
     1250        $old_stylesheet = get_option('stylesheet'); 
    12491251        update_option('template', $template); 
    12501252        update_option('stylesheet', $stylesheet); 
    12511253        if ( count($wp_theme_directories) > 1 ) { 
     
    12581260                $default_theme_mods = (array) get_option( "mods_$theme" ); 
    12591261                add_option( "theme_mods_$stylesheet", $default_theme_mods ); 
    12601262        } 
    1261         do_action('switch_theme', $theme); 
     1263        do_action('switch_theme', $template, $stylesheet, $old_template, $old_stylesheet); 
    12621264} 
    12631265 
    12641266/**