admin管理员组

文章数量:1325497

The subsite administrators of my multisite installation want to go directly to the subsite home page upon login, bypassing the dashboard. Irrespective of the wisdom of this, it's what they clearly want to do.

I have attempted to implement the suggestions found in the following two posts (among others) without success:

Multisite - Redirect All Users to Subsite Home Page on Subsite Login (including removing the "if (is_admin)" code ).

This seems like it should be straight-forward, but I am struggling. Any guidance would be most appreciated.

The subsite administrators of my multisite installation want to go directly to the subsite home page upon login, bypassing the dashboard. Irrespective of the wisdom of this, it's what they clearly want to do.

I have attempted to implement the suggestions found in the following two posts (among others) without success:

https://stackoverflow/questions/8127453/redirect-after-login-on-wordpress

Multisite - Redirect All Users to Subsite Home Page on Subsite Login (including removing the "if (is_admin)" code ).

This seems like it should be straight-forward, but I am struggling. Any guidance would be most appreciated.

Share Improve this question edited May 23, 2017 at 12:40 CommunityBot 1 asked Aug 25, 2014 at 18:26 mike31mike31 134 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can use the login_redirect filter:

add_filter( 'login_redirect', 'wpse_159078_login_redirect' );
function wpse_159078_login_redirect( $redirect ) {
    if( ! current_user_can( 'update_core' ) ) {
        // if it's not a super admin that's logging in
        $redirect = get_home_url();
    }
    return $redirect;

}

References

  • login_redirect filter
  • get_home_url()

本文标签: Multisite Redirect Subsite Administrator to Subsite Home PageBypassing Dashboard