Forums

redirect on login error (3 posts)

  1. skarck
    Member
    Posted 1 year ago #

    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!

  2. skarck
    Member
    Posted 1 year ago #

    is there really no solution?

  3. xRommelx
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic