Pages

Wednesday, June 12, 2013

How to redirect non-admin users to home page (wordpress)? [resolved]


Please write below code in functions.php

function drop_login_redirect( $redirect_to, $request, $user  ) {
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : site_url();
}
add_filter( 'login_redirect', 'drop_login_redirect', 10, 3 );

No comments: