I have a WordPress multisite network and would like to redirect all users who log into a subsite to the subsite's home page.

I have found many plugins and functions.php code that redirect to the main site for the network, but I have been unable to find a solution that will redirect users to a subsite's home page, thus bypassing the dashboard for the subsite.

Ideally, the solution would redirect all roles (administrator through subscriber). Any guidance would be most appreciated!

Thanks, Mike

  • 1
    Why do you want to redirect all users to the homepage? Seems confusing if someone was trying to access wp-admin and after logging in, is redirected to the homepage.
    – user42826
    Commented Dec 19, 2013 at 6:33
  • In this instance, many users will be confused by seeing the dashboard first. That is, they are expecting an experience more like Facebook where you see the content first (the real reason most are there) and then take another step to configure options. Further, the home page has links into the few areas of the dashboard most users will need--but in a much more intuitive way. So, I'd like to get people straight to the home page for each subsite.
    – user44101
    Commented Dec 19, 2013 at 6:43

1 Answer 1


Try something like this:

add_action( 'wp_login','redirect_to_homepage');
function redirect_to_homepage() {
    // if user is accessing admin page/dashboard do not redirect
    if (is_admin()) {  
    wp_redirect( get_home_url());

Edited to add optional line that does not redirect if user is accessing the Dashboard.

  • where I will edit this code?
    – Amran
    Commented Oct 9, 2019 at 7:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.