To redirect back to the previous page after a WordPress user logs in or registers for a new account, insert get_permalink()
in the wp_login_url()
function. After filling out the form, you will no longer be redirected to the wordpress dashboard, but to the previous page.
1 |
<?php echo '<a href="'.wp_login_url(get_permalink()).'" title="Login">Login</a>'; ?> |
1 |
<?php echo '<a href="'.wp_registration_url(get_permalink()).'" title="Login">Login</a>'; ?> |