diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 29cac97917..53fd8671d1 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -3463,6 +3463,7 @@ function wp_ajax_update_theme() { $status = array( 'update' => 'theme', 'slug' => $stylesheet, + 'oldVersion' => '', 'newVersion' => '', ); @@ -3471,6 +3472,11 @@ function wp_ajax_update_theme() { wp_send_json_error( $status ); } + $theme = wp_get_theme( $stylesheet ); + if ( $theme->exists() ) { + $status['oldVersion'] = $theme->get( 'Version' ); + } + include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); $current = get_site_transient( 'update_themes' ); @@ -3502,7 +3508,7 @@ function wp_ajax_update_theme() { } $theme = wp_get_theme( $stylesheet ); - if ( $theme->get( 'Version' ) ) { + if ( $theme->exists() ) { $status['newVersion'] = $theme->get( 'Version' ); }