[wp-trac] [WordPress Trac] #7795: Activate and Deactivate Theme hooks

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 15 12:44:15 UTC 2012


#7795: Activate and Deactivate Theme hooks
-------------------------+-----------------------------
 Reporter:  jacobsantos  |       Owner:
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  Future Release
Component:  Themes       |     Version:  2.7
 Severity:  normal       |  Resolution:
 Keywords:  revert       |
-------------------------+-----------------------------

Comment (by egorpromo):

 Theme deactivation hook: 'after_switch_theme'[[BR]]
 Theme activation hook: 'switch_theme'

 That is my opinion. I've made tests.
 {{{
 //Deactivation
 add_action( 'after_switch_theme', 'my_deactivation' );
 function my_deactivation($old_theme)
 {
         echo '<h1>Deactivation for '.$old_theme.'</h1>';
 }

 //Activation
 add_action("switch_theme", "my_activation", 10 , 2);
 function my_activation($new_theme_name, $new_theme_class)
 {
         echo '<h1>my_activation()</h1>';
         echo '<pre>';
         var_dump($new_theme_name);
         echo '</pre>';

         echo '<pre>';
         var_dump($new_theme_class);
         echo '</pre>';
 }
 }}}
 Tested on version 3.4.2

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/7795#comment:37>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list