Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13530 closed enhancement (duplicate)

Should switch_to_blog() call $wp_rewrite->init(); ?

Reported by: jimisaacs's profile jimisaacs Owned by: wpmuguru's profile wpmuguru
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Multisite Keywords: swtich_to_blog, wp_rewrite
Focuses: Cc:

Description

This is more of a question than a report, because I am still not quite sure what the intended outcome or procedure is when using switch_to_blog().

My current usage is, get_blog_list()
Loop through the list calling switch_to_blog(), and then restore_current_blog() for each iteration.

This is the way I used to do things with MU, now I am getting weird outcomes having to do with permalink structures for post taxonomies.

These all seem to disappear when I call $wp_rewrite->init() along with the previous calls. So I was wondering what am I doing wrong? Or should this call be included in switch_to_blog() ?

Change History (7)

#1 @nacin
14 years ago

  • Owner set to wpmuguru
  • Status changed from new to assigned

#2 @ryan
14 years ago

Re-initializing rewrite after switch_to_blog() has always been rather undefined. To do it properly would require unloading and reloading all plugins.

#3 @ryan
14 years ago

Initializing rewrite in switch_to_blog() probably wouldn't hurt though.

#4 @ryan
14 years ago

Could you document the weird outcomes so we can see if there are underlying causes we need to address beyond doing an init().

#5 @ryan
14 years ago

init() is pretty expensive so it probably won't be added to switch_to_blog(). Are you using custom posts or taxonomies? If so, are they being defined for all blogs (the entire site) or only certain blogs.

#6 @wpmuguru
14 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

Closing this as a duplicate of #12040.

#7 @nacin
14 years ago

  • Milestone 3.0 deleted
Note: See TracTickets for help on using tickets.