From 4796e96ebefd0c4d0f412f3e6caceb977dfd2c78 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Thu, 10 Sep 2015 23:49:14 +0000 Subject: [PATCH] Flush rewrite rules upon theme switch Themes can ( and do ) but shouldn't include custom rewrite rules.This can lead to hard to debug issues for theme authors. Theme changes are not a ultra common conclusion. Flushing the rewrite rules on theme switch will lead to a clean slate for each theme which helps make debugging easier. And @nacin said we should do this 5 years ago at WordCamp Mid Atlantic. Fixes #14849 git-svn-id: https://develop.svn.wordpress.org/trunk@34028 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/theme.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 07b0f6a208..130b90e645 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1888,6 +1888,7 @@ function check_theme_switched() { /** This action is documented in wp-includes/theme.php */ do_action( 'after_switch_theme', $stylesheet ); } + flush_rewrite_rules(); update_option( 'theme_switched', false ); }