diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 07b0f6a..98d806f 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -671,12 +671,14 @@ function locale_stylesheet() {
  * @global array                $wp_theme_directories
  * @global WP_Customize_Manager $wp_customize
  * @global array                $sidebars_widgets
+ * @global array                $wp_theme_mods
  *
  * @param string $stylesheet Stylesheet name
  */
 function switch_theme( $stylesheet ) {
-	global $wp_theme_directories, $wp_customize, $sidebars_widgets;
+	global $wp_theme_directories, $wp_customize, $sidebars_widgets, $wp_theme_mods;
 
+	$wp_theme_mods = false;
 	$_sidebars_widgets = null;
 	if ( 'wp_ajax_customize_save' === current_action() ) {
 		$_sidebars_widgets = $wp_customize->post_value( $wp_customize->get_setting( 'old_sidebars_widgets_data' ) );
@@ -796,23 +798,29 @@ function validate_current_theme() {
  * Retrieve all theme modifications.
  *
  * @since 3.1.0
+ * @global array $wp_theme_mods
  *
  * @return array|void Theme modifications.
  */
 function get_theme_mods() {
-	$theme_slug = get_option( 'stylesheet' );
-	$mods = get_option( "theme_mods_$theme_slug" );
-	if ( false === $mods ) {
-		$theme_name = get_option( 'current_theme' );
-		if ( false === $theme_name )
-			$theme_name = wp_get_theme()->get('Name');
-		$mods = get_option( "mods_$theme_name" ); // Deprecated location.
-		if ( is_admin() && false !== $mods ) {
-			update_option( "theme_mods_$theme_slug", $mods );
-			delete_option( "mods_$theme_name" );
+	global $wp_theme_mods;
+
+	if ( empty( $wp_theme_mods ) ) {
+		$theme_slug     = get_option( 'stylesheet' );
+		$wp_theme_mods = get_option( "theme_mods_$theme_slug" );
+		if ( false === $wp_theme_mods ) {
+			$theme_name = get_option( 'current_theme' );
+			if ( false === $theme_name ) {
+				$theme_name = wp_get_theme()->get( 'Name' );
+			}
+			$wp_theme_mods = get_option( "mods_$theme_name" ); // Deprecated location.
+			if ( is_admin() && false !== $wp_theme_mods ) {
+				update_option( "theme_mods_$theme_slug", $wp_theme_mods );
+				delete_option( "mods_$theme_name" );
+			}
 		}
 	}
-	return $mods;
+	return $wp_theme_mods;
 }
 
 /**
