Codex tools: Log in
Contents |
Restores previous blog after a switch_to_blog call.
Contrary to the function's name, this does NOT restore the original blog but the previous blog. Calling `switch_to_blog()` twice in a row and then calling this function will result in being on the blog set by the first `switch_to_blog()` call.
None
<?php restore_current_blog(); ?>
<?php
global $switched;
switch_to_blog(7);
echo 'You switched from blog ' . $switched . ' to 7';
restore_current_blog();
echo 'You switched back.';
?>
Restore current blog should only be called after switch_to_blog.