mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Themes: Avoid autoloading the previous theme's theme mods when switching to another theme.
This reduces unnecessarily autoloaded data from inactive themes, which can contribute to slow database performance as part of excessive autoloading. Props mukesh27, rajinsharwar, igmoweb, joemcgill, swissspidy, westonruter, flixos90. Fixes #59537. See #59975. git-svn-id: https://develop.svn.wordpress.org/trunk@57153 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -840,6 +840,13 @@ function switch_theme( $stylesheet ) {
|
||||
$new_theme->delete_pattern_cache();
|
||||
$old_theme->delete_pattern_cache();
|
||||
|
||||
// Set autoload=no for the old theme, autoload=yes for the switched theme.
|
||||
$theme_mods_options = array(
|
||||
'theme_mods_' . $stylesheet => 'yes',
|
||||
'theme_mods_' . $old_theme->get_stylesheet() => 'no',
|
||||
);
|
||||
wp_set_option_autoload_values( $theme_mods_options );
|
||||
|
||||
/**
|
||||
* Fires after the theme is switched.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user