Skip to content

Commit ad18c94

Browse files
author
Felix Arntz
committed
Clear template content caches when switching theme.
1 parent d718931 commit ad18c94

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/wp-includes/theme.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,12 @@ function switch_theme( $stylesheet ) {
877877
$new_theme->delete_pattern_cache();
878878
$old_theme->delete_pattern_cache();
879879

880+
// Clear template content caches.
881+
delete_transient( 'wp_theme_template_contents_' . $new_theme->get_stylesheet() );
882+
delete_transient( 'wp_theme_template_contents_' . $new_theme->get_template() );
883+
delete_transient( 'wp_theme_template_contents_' . $old_theme->get_stylesheet() );
884+
delete_transient( 'wp_theme_template_contents_' . $old_theme->get_template() );
885+
880886
/**
881887
* Fires after the theme is switched.
882888
*

0 commit comments

Comments
 (0)