mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 10:44:26 +00:00
Move home and siteurl update events to action hooks.
git-svn-id: https://develop.svn.wordpress.org/trunk@4175 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2064,4 +2064,18 @@ function wp_reset_vars($vars) {
|
||||
}
|
||||
}
|
||||
|
||||
// If siteurl or home changed, reset cookies and flush rewrite rules.
|
||||
function update_home_siteurl($old_value, $value) {
|
||||
global $wp_rewrite, $user_login, $user_pass_md5;
|
||||
// If home changed, write rewrite rules to new location.
|
||||
$wp_rewrite->flush_rules();
|
||||
// Clear cookies for old paths.
|
||||
wp_clearcookie();
|
||||
// Set cookies for new paths.
|
||||
wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl'));
|
||||
}
|
||||
|
||||
add_action('update_option_home', 'update_home_siteurl');
|
||||
add_action('update_option_siteurl', 'update_home_siteurl');
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user