• Resolved beautyb

    (@beautyb)


    I have a WordPress multisite setup, but when subscribers login, it sends them to the dashboard. I would like to have subscribers sent to their respective child site and not the dashboard without having to redirect each user individually.

    Is there any way to do such a thing?

Viewing 1 replies (of 1 total)
  • Thread Starter beautyb

    (@beautyb)

    Wanted to throw out there that I found the solution if anyone needs it. Put the .php in WordPress Must-Use folder and it will do exactly what I was asking about

    <?php
    function ds_login_redirect( $redirect_to, $request_redirect_to, $user )
    {
        if ($user->ID != 0) {
            $user_info = get_userdata($user->ID);
            if ($user_info->primary_blog) {
                $primary_url = get_blogaddress_by_id($user_info->primary_blog) . '';
                if ($primary_url) {
                    wp_redirect($primary_url);
                    die();
                }
            }
        }
        return $redirect_to;
    }
    add_filter('login_redirect','ds_login_redirect', 100, 3);
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • The topic ‘Send logged in users to their site’ is closed to new replies.