auth_redirect() doesn’t send users back
-
For the login form, I used the default wp_login_form input names, and the default value for the hidden type input named redirect_to which is: ( is_ssl() ? ‘https://’ : ‘http://’ ) . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] .
for some pages, I want user to login to access to them, so I use the auth_redirect() function, as expected it sends users to the login page, but after login, doesn’t send them back to the page they were originally.
So I tried to filter the login_redirect… but it doesn’t work. Thanks for your help!
function my_login_redirect_function(){ if(( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] == get_bloginfo('url').'/login'){ return get_bloginfo('url').'/dashboard'; }else{ $urlStartPos= strstr($_SERVER['REQUEST_URI'], 'http'); return(urldecode($urlStartPos)); } add_filter('login_redirect','my_login_redirect_function');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘auth_redirect() doesn’t send users back’ is closed to new replies.