Redirect wordpress user after log in

There are a couple ways to do this. Based off, “role” or “capability”. Often I use Just Tadlocks Members plugin to create custom roles for clients to not over burden them with every thing in the dashboard. Because of this, I think using “Capabilities” is a much better way of going about it.

Redirect user based off role … you can change “administrator” to be:
administrator
editor
subscriber
author
contributor

function my_login_redirect( $redirect_to, $request, $user ) {
	//is there a user to check?
	global $user;
	if ( isset( $user->roles ) && is_array( $user->roles ) ) {
		//check for admins
		if ( in_array( 'administrator', $user->roles ) ) {
			// redirect them to the default place
			return $redirect_to;
		} else {
			return home_url();
		}
	} else {
		return $redirect_to;
	}
}
add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );

 

Redirect User based off Capability: List of Capabilities

Ex: If user can moderate comments, redirect to home…

function wps_login_redirect_contributors() {
  if ( current_user_can('moderate_comments') ){
     return home_url();
  }
}

add_filter('login_redirect', 'wps_login_redirect_contributors');

If user can not update core, redirect home…

function wps_login_redirect_contributors() {
  if ( !current_user_can('update_core') ){
     return home_url();
  }
}

add_filter('login_redirect', 'wps_login_redirect_contributors');

You get the idea…