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. Built from https://develop.svn.wordpress.org/trunk@57153 git-svn-id: http://core.svn.wordpress.org/trunk@56664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
65d5985a7c
commit
3a961371dc
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57152';
|
||||
$wp_version = '6.5-alpha-57153';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue