do_action( 'after_switch_theme', string $old_name, WP_Theme $old_theme )
Fires on the first WP load after a theme switch if the old theme still exists.
Description
This action fires multiple times and the parameters differs according to the context, if the old theme exists or not. If the old theme is missing, the parameter will be the slug of the old theme.
Parameters
More Information
Callback functions attached to this hook are only triggered in the theme (and/or child theme) being activated. To do things when your theme is deactivated, use switch_theme.
Source
File: wp-includes/theme.php
Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/after_switch_theme