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:
parent
22f5bd4655
commit
9e9f4ad923
|
@ -819,7 +819,7 @@ endif;
|
||||||
* so the error code must be checked) or failure.
|
* so the error code must be checked) or failure.
|
||||||
*/
|
*/
|
||||||
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
|
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();
|
$errors = new WP_Error();
|
||||||
if ( '' == $domain )
|
if ( '' == $domain )
|
||||||
|
@ -936,9 +936,9 @@ We hope you enjoy your new site. Thanks!
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $subdomain_install )
|
if ( $subdomain_install )
|
||||||
update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
|
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
||||||
else
|
else
|
||||||
update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/');
|
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
|
||||||
|
|
||||||
flush_rewrite_rules();
|
flush_rewrite_rules();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue