Created
June 26, 2014 15:44
-
-
Save messica/ad1c8f00f6acbc176d3d to your computer and use it in GitHub Desktop.
Redirect admins to dashboard, everyone else to home page.
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 | |
| /* | |
| * Redirect admins to dashboard, everyone else to home page. | |
| */ | |
| function my_pmpro_login_redirect_url($url, $request, $user) { | |
| //only do this if we have a user | |
| if(is_a($user, 'WP_User')) { | |
| if(in_array('administrator', $user->roles)) | |
| $url = admin_url(); | |
| else | |
| $url = home_url(); | |
| } | |
| return $url; | |
| } | |
| add_filter('pmpro_login_redirect_url', 'my_pmpro_login_redirect_url', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment