switch_to_blog() should affect $current_blog global
|Reported by:||filosofo||Owned by:||filosofo|
Currently, switch_to_blog() does not change the $current_blog global set of variables. So functions such as is_main_site() will continue to use the previous set blog id.
So for example if you switch to another blog while acting as a site admin to flush rewrite rules on a non-main blog, the non-main blog gets the main-blog-specific rewrite rules.
My general suggestion is that we move $current_blog into a function like get_current_blog and not count on the global to be populated correctly, then replace $current_blog global variable references with calls to get_current_blog, which will handle the current blog situation correctly.
Change History (6)
4 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 3.5