Pro Sites Password reset going to main site

When a regular user clicks on Lost your password? it goes to the main site. At the end of the process when they click login it goes to the main site login page not their site.

This is when the user gets confused and calls you like he's going to die.

Thank You!

  • Predrag Dubajic
    • Support

    Hey @Jose,

    Hope you're well :slight_smile:

    This is actually multisite issue but you can try bypassing it by creating new .php file in your mu-plugins folder and pasting this code in it:

    <?php
    add_filter('login_redirect', 'custom_redirect_filter', 0, 3);
    
    function custom_redirect_filter($redirect_to, $request, $user) {
    $user_blogs = get_blogs_of_user($user->ID);
    foreach ($user_blogs as $user_blog) {
    $user_blog->path;
    return site_url($user_blog->path);
    }
    return site_url();
    }

    Let us know if this worked for you.

    Best regards,
    Predrag

  • Predrag Dubajic
    • Support

    Hi Jose,

    Sorry for the lack of details, I forgot to mention that if you don't have mu-plugins folder you can go ahead and simply create one yourself inside wp-content folder. MU stands for Must Use so plugins placed there don't require activation from your admin section.

    You can name the file anything you want, but I would stick to something like redirect-on-login.php so you know what it does.

    Let me know how it goes.

    Best regards,
    Predrag

  • Predrag Dubajic
    • Support

    Hi Jose,

    Hmmm, not sure why this didn't work for you.
    Could you send us your FTP login details so we can investigate this further?

    You can send us your details using our contact form and this template:

    Subject: "Attn: Predrag Dubajic"
    - WordPress admin username
    - WordPress admin password
    - login url
    - FTP credentials (host/username/password)
    - link back to this thread for reference
    - any other relevant urls

    IMPORTANT: Make sure you select "I have a different question" for your topic so it doesn't go back to forums - this and the subject line ensure that it gets assigned to me.

    Best regards,
    Predrag

  • Adam Czajczyk
    • Support Gorilla

    Hey Jose,

    I hope you're well today!

    My colleague @Predrag Dubajic was right about the redirect issue when giving you a code, however there's another problem. What you're talking about seems to be a long running issue and was reported as a WP bug about 3 years ago. Please take a look here:

    https://core.trac.wordpress.org/ticket/21352

    Fortunately, there's also a couple of possible fixes given there and this one seems to be working:

    https://gist.github.com/eteubert/293e07a49f56f300ddbb

    How to apply it?

    1. Create a file called "passwort-reset-on-local-blog.php"
    2. Paste the given code into it and save
    3. upload to the /wp-content/mu-plugins folder

    If it doesn't work, delete the file from /wp-content/mu-plugins and upload to /wp-content/plugins and then network-activate it.

    Let me know please if it worked for you!

    Cheers,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.