Created
March 24, 2016 14:37
-
-
Save sjaved87/d1c96c8a8ca033ece106 to your computer and use it in GitHub Desktop.
This code snippet will detect the user's site automatically on login and redirect to respective site after login. For WordPress MultiSite only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function go_to_primary_blog($redirect_to, $request, $user){ | |
| $user_info = get_userdata($user->ID); | |
| return get_blogaddress_by_id($user_info->primary_blog) . 'wp-admin'; | |
| } | |
| add_filter("login_redirect", "go_to_primary_blog", 999, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment