do_action( 'after_switch_theme', string $old_name , WP_Theme $old_theme )
Fires on the next WP load after the theme has been switched.
Contents
Description
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 ‘switch_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
.
View all references
do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
Add options for your theme and set them to their default values.
Update the default medium image size when a theme is activated.