Site icon Hip-Hop Website Design and Development

auth_redirect() does not ship customers to the web page the place they orginally tried to acces

Within the website I’m constructing, I am utilizing "theme my plugin" so I may make my very own login, logout, registration pages.

For the login kind, I used the default wp_login_form enter names, and the default worth for the hidden sort enter named redirect_to which is: ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] .

for some pages, I would like consumer to login to entry to them, so I take advantage of the auth_redirect() operate, as anticipated it sends customers to the login web page, however after login, does not ship them again to the web page they have been initially.

So I attempted to filter the login_redirect… however it does not work. Thanks in your assist!

operate 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');