From deeb5f14719f8c864df657d69c0f1e93e1c58a42 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 7 Feb 2016 08:26:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@36502 git-svn-id: http://core.svn.wordpress.org/trunk@36469 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 5 ++++- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index b2543639bc..43334865c2 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -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 ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 2ad2c00f5b..57b9e1b8ed 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36501'; +$wp_version = '4.5-alpha-36502'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.