after_switch_theme

after_switch_theme

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7

do_action('after_switch_theme') is found 2 times:

  • /wp-includes/theme.php line 3504
    			 *
    			 * @param string   $old_name  Old theme name.
    			 * @param WP_Theme $old_theme WP_Theme instance of the old theme.
    			 */
    			do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
    		} else {
    			/** This action is documented in wp-includes/theme.php */
    			do_action( 'after_switch_theme', $stylesheet, $old_theme );
    		}
    
    		flush_rewrite_rules();
    
  • /wp-includes/theme.php line 3507
    			 */
    			do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
    		} else {
    			/** This action is documented in wp-includes/theme.php */
    			do_action( 'after_switch_theme', $stylesheet, $old_theme );
    		}
    
    		flush_rewrite_rules();
    
    		update_option( 'theme_switched', false );
    	}
    

See this hook used in plugins: