#13530 closed enhancement (duplicate)
Should switch_to_blog() call $wp_rewrite->init(); ?
Reported by: | jimisaacs | Owned by: | 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)
#4
@
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
@
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.
Re-initializing rewrite after switch_to_blog() has always been rather undefined. To do it properly would require unloading and reloading all plugins.