Themes: Pass information about the old theme in the form of a `WP_Theme` object when the `switch_theme` action is fired.
Props MikeHansenMe. See #22401. git-svn-id: https://develop.svn.wordpress.org/trunk@36502 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2caad3f7b2
commit
1c2f0896db
|
@ -739,15 +739,18 @@ function switch_theme( $stylesheet ) {
|
|||
}
|
||||
|
||||
update_option( 'theme_switched', $old_theme->get_stylesheet() );
|
||||
|
||||
/**
|
||||
* Fires after the theme is switched.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 4.5.0 Introduced the `$old_theme` parameter.
|
||||
*
|
||||
* @param string $new_name Name of the new theme.
|
||||
* @param WP_Theme $new_theme WP_Theme instance of the new theme.
|
||||
* @param WP_Theme $old_theme WP_Theme instance of the old theme.
|
||||
*/
|
||||
do_action( 'switch_theme', $new_name, $new_theme );
|
||||
do_action( 'switch_theme', $new_name, $new_theme, $old_theme );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue