Redirect Non-Administrators User After Login in WordPress

/* Redirect Non-Administrators user After Login */
function acme_login_redirect( $redirect_to, $request, $user  ) {
//  $perticular_page = get_permalink(4); Use site_url() to $perticular_page for redirect on perticular page
return ( is_array( $user->roles ) && in_array( ‘administrator’, $user->roles ) ) ? admin_url() : site_url();
}
add_filter( ‘login_redirect’, ‘acme_login_redirect’, 10, 3 );

Advertisements

Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: