From bf4846985f6cbbc8a40d759cad29bd0ca7a2b564 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Mon, 28 Sep 2015 23:23:44 +0000 Subject: [PATCH] MS: Delete `rewrite_rules` when updating a switched site's URL. Previously, rewrite rules could be flushed and regenerated in the context of another site. Deleting the rules when in a switched state allows for them to be generated properly on the next page view. Fixes #33816. git-svn-id: https://develop.svn.wordpress.org/trunk@34672 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/misc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 454c68647a..0e104e0d38 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -246,8 +246,11 @@ function update_home_siteurl( $old_value, $value ) { if ( defined( "WP_INSTALLING" ) ) return; - // If home changed, write rewrite rules to new location. - flush_rewrite_rules(); + if ( is_multisite() && ms_is_switched() ) { + delete_option( 'rewrite_rules' ); + } else { + flush_rewrite_rules(); + } } /**