Title: redirect on login error
Last modified: August 19, 2016

---

# redirect on login error

 *  [skarck](https://wordpress.org/support/users/skarck/)
 * (@skarck)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/redirect-on-login-error/)
 * hi!
 * i use `php wp_login_form()` to display a login form in my theme and set the redirect
   value to `$_SERVER['REQUEST_URI']` . redirection works fine when the user types
   in the correct data, but on login errors i get stuck on the default login form.
 * so, anyone knows a way to redirect to the last page even on login errors?
    i 
   would appreciate any help!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [skarck](https://wordpress.org/support/users/skarck/)
 * (@skarck)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/redirect-on-login-error/#post-1667588)
 * is there really no solution?
 *  [xRommelx](https://wordpress.org/support/users/xrommelx/)
 * (@xrommelx)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/redirect-on-login-error/#post-1667589)
 * do you show the login page link in the blog or website ???
    if you answer is 
   yes you can use something like this
 * where u show the login page link
    use something like this
 * `wp-login.php?redirect=<?php echo $_SERVER['REQUEST_URI'] ?>;`
 * now you have this in a var, so now just use this var, and if the login is correct
   you can use a header(‘location’) and redirect to the last page or where the user
   come from

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘redirect on login error’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [xRommelx](https://wordpress.org/support/users/xrommelx/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/redirect-on-login-error/#post-1667589)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
