Support » Plugin: Clean Login » Login re-direct to previous page

  • Resolved emgb_520


    I have the [clean-login] shortcode on a custom login page for clients.

    For example, I have a landing page link for a client, when they go to it, they get re-directed to login. After logging in, the page stays on the login page (the URL is, it does not re-direct to the previous page (client landing page) even though the Plugin code suggests it should with this line in clean-login.php:

    // Sets the redirect url to the current page
    $url = clean_login_url_cleaner( wp_get_referer() );

    I have seen a ton of people complain about this. Is there a fix I am just not seeing? I really need this to work the correct way.


    • This topic was modified 1 year, 4 months ago by emgb_520.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @emgb_520,

    I am a user of this plugin and I had the same issue. I reworked the plugin a bit and during that process, I discovered that the referrer url does not always refer to what you think it should. The issue you are seeing is happening because there is a redirect that is happening that you don’t see and the referrer gets lost. What I did to circumvent this was add the referrer on the original request into the Session object. Then I check that Session object after the user is signed in.

    This is a quick way for you to get the value of the url the user came from. Please note that you have to account for situations where the url is actually blank, like when a user types in sign-in into the url bar, you need to check to see if the variable is blank and then redirect the user to a page of your choosing.

    I know I am not the developer of this plugin, but when I see a user having the same issues I was having, I have been responding and telling them what I did to solve the issues. Hopefully, it works out for you.


    I appreciate your explanation here. Is there any way you would be willing to share the custom code you added and where within the plugin file you added it?

    (I am not yet well versed enough with PHP.)

    Thanks so much!


    • This reply was modified 1 year, 3 months ago by emgb_520.

    Hello! Does anyone else have a resolution for this?


    Plugin Author Alberto Hornero



    It seems to be a limitation due to any incompatibility. Already tested and working. Could you please try to disable additional plugins?


    Hello, Alberto.

    I will test this and comment back here with the results.

    Thank you!

    Ok, so I logged in to my dev site and disabled EVERY plugin but “Clean Login”.

    I created a page: /test

    Where I put a login link that took me to the “Login” page with the [clean-login] shortcode. I logged in, but was not re-directed back to /test.

    Instead it stayed on the login page but had this string after the URL


    It is not re-directing back to the previous page.

    Please help! This is the last thing that needs done to launch the site and my client is getting antsy.

    Thank you so much!

    Plugin Author Alberto Hornero


    Hi, due to personal issues I am away. Another user/contributor has sent me a proposal of change in terms of this issue. So, hopefully, it will be solved in the next update.


    Plugin Author Alberto Hornero


    Update released! This should solve your issue. Regards,


    Thank you, I was told you were out on temporary leave, so I appreciate your attention here.

    I updated, but am still not seeing any option for re-direct to previous URL on login. Only an option for making login redirect to a particular page.

    I created some private client pages. When a client goes to their page link, it re-directs to the login page with the shortcode. After they login there, they should be re-directed back to their client page.


    Plugin Author Alberto Hornero


    Wow, I’m completely out of my mind. Sorry, this was the answer for another thread. There is no solution for your topic yet; if someone contributes or I can get more time soon I’d integrate it.

    Sorry for the misunderstanding.


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Login re-direct to previous page’ is closed to new replies.