mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-21 22:15:28 +00:00
Avoid fatal errors in check_theme_switched() if we fail to get a WP_Theme object for the old theme. Fixes #20334.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2a29da4d31
commit
fba41a5b3a
@ -1555,7 +1555,13 @@ add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
|
||||
function check_theme_switched() {
|
||||
if ( $stylesheet = get_option( 'theme_switched' ) ) {
|
||||
$old_theme = wp_get_theme( $stylesheet );
|
||||
do_action( 'after_switch_theme', $old_theme->get('Name'), $old_theme );
|
||||
|
||||
// If we can't find the old theme then fallback to passing the raw data to the action like we did pre-3.4
|
||||
if ( $old_theme )
|
||||
do_action( 'after_switch_theme', $old_theme->get('Name'), $old_theme );
|
||||
else
|
||||
do_action( 'after_switch_theme', $stylesheet );
|
||||
|
||||
update_option( 'theme_switched', false );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user