Make WordPress Core

Ticket #33628: wp_theme_mods_cache1.patch

File wp_theme_mods_cache1.patch, 2.2 KB (added by spacedmonkey, 11 years ago)
  • wp-includes/theme.php

    diff --git a/wp-includes/theme.php b/wp-includes/theme.php
    index 07b0f6a..98d806f 100644
    a b function locale_stylesheet() {  
    671671 * @global array                $wp_theme_directories
    672672 * @global WP_Customize_Manager $wp_customize
    673673 * @global array                $sidebars_widgets
     674 * @global array                $wp_theme_mods
    674675 *
    675676 * @param string $stylesheet Stylesheet name
    676677 */
    677678function switch_theme( $stylesheet ) {
    678         global $wp_theme_directories, $wp_customize, $sidebars_widgets;
     679        global $wp_theme_directories, $wp_customize, $sidebars_widgets, $wp_theme_mods;
    679680
     681        $wp_theme_mods = false;
    680682        $_sidebars_widgets = null;
    681683        if ( 'wp_ajax_customize_save' === current_action() ) {
    682684                $_sidebars_widgets = $wp_customize->post_value( $wp_customize->get_setting( 'old_sidebars_widgets_data' ) );
    function validate_current_theme() {  
    796798 * Retrieve all theme modifications.
    797799 *
    798800 * @since 3.1.0
     801 * @global array $wp_theme_mods
    799802 *
    800803 * @return array|void Theme modifications.
    801804 */
    802805function get_theme_mods() {
    803         $theme_slug = get_option( 'stylesheet' );
    804         $mods = get_option( "theme_mods_$theme_slug" );
    805         if ( false === $mods ) {
    806                 $theme_name = get_option( 'current_theme' );
    807                 if ( false === $theme_name )
    808                         $theme_name = wp_get_theme()->get('Name');
    809                 $mods = get_option( "mods_$theme_name" ); // Deprecated location.
    810                 if ( is_admin() && false !== $mods ) {
    811                         update_option( "theme_mods_$theme_slug", $mods );
    812                         delete_option( "mods_$theme_name" );
     806        global $wp_theme_mods;
     807
     808        if ( empty( $wp_theme_mods ) ) {
     809                $theme_slug     = get_option( 'stylesheet' );
     810                $wp_theme_mods = get_option( "theme_mods_$theme_slug" );
     811                if ( false === $wp_theme_mods ) {
     812                        $theme_name = get_option( 'current_theme' );
     813                        if ( false === $theme_name ) {
     814                                $theme_name = wp_get_theme()->get( 'Name' );
     815                        }
     816                        $wp_theme_mods = get_option( "mods_$theme_name" ); // Deprecated location.
     817                        if ( is_admin() && false !== $wp_theme_mods ) {
     818                                update_option( "theme_mods_$theme_slug", $wp_theme_mods );
     819                                delete_option( "mods_$theme_name" );
     820                        }
    813821                }
    814822        }
    815         return $mods;
     823        return $wp_theme_mods;
    816824}
    817825
    818826/**