[wp-trac] [WordPress Trac] #9152: Custom header from theme A used when previewing theme B

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 17 01:00:15 GMT 2009

#9152: Custom header from theme A used when previewing theme B
 Reporter:  Viper007Bond  |       Owner:             
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  2.9        
Component:  Themes        |     Version:  2.8        
 Severity:  normal        |    Keywords:  needs-patch
 As reported by Matt.

 If you're using theme A and set a custom header via the standardized API
 (i.e. a background image and text color) and then preview theme B on the
 theme switcher, the settings from theme A are used. Once you actually
 switch themes though, it works fine and uses the settings from theme B.

 The problem stems from `get_current_theme()` returning theme A even when
 previewing theme B.

 function get_theme_mod($name, $default = false) {
         $theme = get_current_theme();

         $mods = get_option("mods_$theme");

         if ( isset($mods[$name]) )
                 return apply_filters( "theme_mod_$name", $mods[$name] );

         return apply_filters( "theme_mod_$name", sprintf($default,
 get_template_directory_uri(), get_stylesheet_directory_uri()) );

 Still working on a solution to this (i.e. telling WordPress it's using
 theme B during the preview or something).

Ticket URL: <http://core.trac.wordpress.org/ticket/9152>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list