I am using WordPress 3.8.3 and i am using it for multisite.
WordPress multisite switch_to_blog()
and restore_current_blog()
functions works well for single query but in loop restore_current_blog()
function is not working.
Any one have idea how I will fix it?
Thank You.
You need to use restore_current_blog() for each instance of switch_to_blog(). I just ran into this bug myself.
Does not work
Works
It appears that the switch_to_blog() function does not store the original blog globally so it can be restored outside of a multiple loop. I will be investigating to see if this can be fixed somewhat easily and will try to contribute it to core.