In the site I am building, I'm using "theme my plugin" so I could make my own login, logout, registration pages.

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';
            $urlStartPos= strstr($_SERVER['REQUEST_URI'], 'http');
  • What is "theme my plugin"?
    – Tom J Nowell
    Oct 24, 2021 at 20:28
  • it's a plugin... sorry, I made a mistake in the name, it's "theme my login". Its purpose is to replace default wordpress link for login, logout, register, lost password etc...
    – T3mmX
    Jan 13, 2022 at 15:08
  • hmm normally WP would use a redirect_to get parameter, but there's nothing here that reads that, and it's unclear how this plugin is meant to handle the redirect. Have you asked theme my login support? 3rd party plugin dev support is offtopic here, and what would work in normal WP may not work for you, any answer you get here may not apply to theme my login
    – Tom J Nowell
    Jan 13, 2022 at 21:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.