Home/Hooks/after_switch_theme
ACTION

after_switch_theme

Fires on the next WP load after the theme has been switched. The parameters differ according to whether the old theme exists or not. If the old theme is missing, the old name will instead be the slug of the old theme. See {@see 'switch_theme'}.

wp-includes/theme.php
Line 3504
2 Parameters
View Source

Usage

add_action( 'after_switch_theme', 'your_callback_function', 10, 2 );

Action Callback:

function your_callback_function( $old_theme->get('Name'), $old_theme ) {
    // Your code here
    
}

Parameters

$old_theme->get('Name')

Parameter 1

$old_theme

Parameter 2

⚡ Action Hook

Action hooks allow you to insert custom code at specific points during WordPress execution. Actions do not return any values.