wppaste
WordPress

do_action( 'after_switch_theme', string $old_name, WP_Theme $old_theme )

Since
3.3.0
Fires on the next WP load after the theme has been switched.

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

$old_namestring
Old theme name.
$old_themeWP_Theme
WP_Theme instance of the old theme.

Fired at · 2

  • wp-includes/theme.php:3503check_theme_switched()
  • wp-includes/theme.php:3506check_theme_switched()

Source

			 *			 * @since 3.3.0			 *			 * @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();

History

Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.