I am using wordpress and I want to change the redirect URL after login to wordpress to the same page where user logged in from. Currently I am using this code for logged in users:
function admin_default_page() {
return '/new-dashboard-url';
}
add_filter('login_redirect', 'admin_default_page');
Instead of [new-dashboard-url], I want them to go back to the same page where they signed in from. How to do this?
Same thing for registration and password.
If you want to redirect to the last page they were in, you can try something like this:
Seems that it can be done even easier: