Skip to content

Instantly share code, notes, and snippets.

@messica
Created June 26, 2014 15:44
Show Gist options
  • Select an option

  • Save messica/ad1c8f00f6acbc176d3d to your computer and use it in GitHub Desktop.

Select an option

Save messica/ad1c8f00f6acbc176d3d to your computer and use it in GitHub Desktop.
Redirect admins to dashboard, everyone else to home page.
<?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