[resolved] Redirect Users After Login (3 posts)

  1. Equal Web Creative
    Posted 6 years ago #

    I have a multisite installation and when a user is created they are sent an email with details of their login etc.

    In this they can click on a link which takes them to domain.com/wp-login.php. Once logged in they end up on their profile page.

    I would like to make it so that they end up on the home page of the site rather than in the backend. I am fairly sure that I can add some code to functions.php in order to filter what happens after they are logged in, but after many attempts I cannot get it ito work.

    Anyone any ideas. I would rather not use a plugin here, I would rather use some code in the themes functions.php as the same theme will run on all multisites.


  2. raskull
    Posted 6 years ago #

    maybe an answer lies within here: http://mu.wordpress.org/forums/topic/13452

  3. Equal Web Creative
    Posted 6 years ago #

    Finally managed to do it with the code below that redirects all visits to domain.com/wp-login.php to the current blog.

    // redirects all instances of wp-login.php to the site home
    function change_login_redirect($redirect_to, $request_redirect_to, $user) {
                $primary_url = "/";
        return $redirect_to;
    add_filter('login_redirect','change_login_redirect', 100, 3);

Topic Closed

This topic has been closed to new replies.

About this Topic