Codex tools: Log in
Note: If you're using WordPress Multisite, you can instead use switch_to_blog()
Switches the active blog until the user calls the restore_current_blog() function. This function is useful if you need to pull posts, or other information, from other blogs, you can then switch back after using restore_current_blog(). Using this function will not load plugins that only run on the blog you switch to.
This switch is to be used for internal and admin area functions. It's too expensive a query to run on the front end.
<?php switch_to_blog($new_blog) ?>
for global variables, since it is being changed or updated from time to time,
please refer to Related Resources for more information
echo 'You switched from blog ' . $switched . ' to 7';
echo 'You switched back.';
switch_to_blog() is located in
To easily revert back to the blog you were on, restore_current_blog()
Please refer the following links for related variables.WPMU_Global_Variables