Redirect to referrer after login
-
Firstly I would like to congratulate the team on the plugin. Spot on!
I am not a web developer so my question may seem simple however I cannot seem to resolve the issue after lots of searching.
Issue: After a user logs into my site I would like to refer them to the previous page (the referrer).
I have used the below code (from a previous topic I found):
add_filter( ‘wpmem_login_redirect’, ‘my_login_redirect’ );
function my_login_redirect()
{
// return the url that the login should redirect to
return ‘https://google.com’%5D;
}The above redirection works however if i alter it to redirect to the referrer it does not.
add_filter( ‘wpmem_login_redirect’, ‘my_login_redirect’ );
function my_login_redirect()
{
$referrer = $_SERVER[‘HTTP_REFERER’];// return the url that the login should redirect to
return $_SERVER[‘HTTP_REFERER’];
}After using fiddler I noticed that the login page is called twice. I believe this is the issue as the referrer becomes the login page.
Please could you shed any light on a possible fix.
Many thanks,
Joel
- The topic ‘Redirect to referrer after login’ is closed to new replies.