Use WP_Rewrite::set_permalink_structure instead of plain update_option() in populate_network(). Fixes #20174.

This has the benefit of calling WP_Rewrite::init() which correctly resets the permalink_structure
property of the $wp_rewrite global so that the rewrite rules generated on the next flush are correct.


git-svn-id: https://develop.svn.wordpress.org/trunk@20117 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jon Cave 2012-03-05 17:39:26 +00:00
parent 22f5bd4655
commit 9e9f4ad923
1 changed files with 3 additions and 3 deletions

View File

@ -819,7 +819,7 @@ endif;
* so the error code must be checked) or failure.
*/
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
global $wpdb, $current_site, $wp_db_version;
global $wpdb, $current_site, $wp_db_version, $wp_rewrite;
$errors = new WP_Error();
if ( '' == $domain )
@ -936,9 +936,9 @@ We hope you enjoy your new site. Thanks!
}
if ( $subdomain_install )
update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
else
update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
flush_rewrite_rules();