Make WordPress Core


Ignore:
Timestamp:
09/08/2006 09:42:05 PM (17 years ago)
Author:
ryan
Message:

Move home and siteurl update events to action hooks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r4169 r4175  
    20652065}
    20662066
     2067// If siteurl or home changed, reset cookies and flush rewrite rules.
     2068function update_home_siteurl($old_value, $value) {
     2069    global $wp_rewrite, $user_login, $user_pass_md5;
     2070    // If home changed, write rewrite rules to new location.
     2071    $wp_rewrite->flush_rules();
     2072    // Clear cookies for old paths.
     2073    wp_clearcookie();
     2074    // Set cookies for new paths.
     2075    wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl'));
     2076}
     2077
     2078add_action('update_option_home', 'update_home_siteurl');
     2079add_action('update_option_siteurl', 'update_home_siteurl');
     2080
    20672081?>
Note: See TracChangeset for help on using the changeset viewer.