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


Built from https://develop.svn.wordpress.org/trunk@34028


git-svn-id: http://core.svn.wordpress.org/trunk@33997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2015-09-10 23:50:24 +00:00
parent 9bf86a74d0
commit c09b0477b2
2 changed files with 2 additions and 1 deletions

View File

@ -1888,6 +1888,7 @@ function check_theme_switched() {
/** This action is documented in wp-includes/theme.php */ /** This action is documented in wp-includes/theme.php */
do_action( 'after_switch_theme', $stylesheet ); do_action( 'after_switch_theme', $stylesheet );
} }
flush_rewrite_rules();
update_option( 'theme_switched', false ); update_option( 'theme_switched', false );
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34027'; $wp_version = '4.4-alpha-34028';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.