Skip to content

Commit

Permalink
Clear template content caches when switching theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Oct 11, 2023
1 parent d718931 commit ad18c94
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,12 @@ function switch_theme( $stylesheet ) {
$new_theme->delete_pattern_cache();
$old_theme->delete_pattern_cache();

// Clear template content caches.
delete_transient( 'wp_theme_template_contents_' . $new_theme->get_stylesheet() );
delete_transient( 'wp_theme_template_contents_' . $new_theme->get_template() );
delete_transient( 'wp_theme_template_contents_' . $old_theme->get_stylesheet() );
delete_transient( 'wp_theme_template_contents_' . $old_theme->get_template() );

/**
* Fires after the theme is switched.
*
Expand Down

0 comments on commit ad18c94

Please sign in to comment.