I have a site that requires a login to view. Rather than redirect visitors to the home page after login, I thought it would be nice to include a redirect to the current page after login.
It turns out that WordPress handles this quite easily using the following code:
echo '<a href="' . wp_login_url(get_permalink()) . '">Login</a> to view this content.';