Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#20174 closed defect (bug) (fixed)

populate_network() doesn't set up rewrite rules properly

Reported by: duck_'s profile duck_ Owned by: duck_'s profile duck_
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.0
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

The call to flush_rewrite_rules() in populate_network() doesn't actually do much because although the lines before update the permalink_structure this doesn't actually change the value cached in the WP_Rewrite property.

This means that incorrect rewrite rules are stored for the main site when setting up a network. NB: this only occurs when the permalink structure had already been set to something before installing the network.

The fix would be to use $wp_rewrite->set_permalink_structure which updates the option and re-initializes the $wp_rewrite global to use the new structure.

Attachments (1)

20174.diff (1002 bytes) - added by duck_ 13 years ago.

Download all attachments as: .zip

Change History (6)

@duck_
13 years ago

#1 follow-up: @ocean90
13 years ago

Related: #20171?

#2 in reply to: ↑ 1 @duck_
13 years ago

Replying to ocean90:

Related: #20171?

Yeah. I forgot to mention that.

#3 @duck_
13 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from new to closed

In [20117]:

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.

#4 @duck_
13 years ago

  • Milestone changed from Awaiting Review to 3.4

#5 @nacin
13 years ago

Looks good.

Note: See TracTickets for help on using tickets.