Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function redirect_logged_in_user()
- {
- if( is_user_logged_in ) {
- wp_redirect('http://customurl');
- }
- }
- global $pagenow;
- if( $pagenow == 'wp-login.php')
- redirect_logged_in_user();
- <?php
- function daro_login_redirect( $redirect_to, $request, $user ) {
- //is there a user to check?
- if ( isset( $user->roles ) && is_array( $user->roles ) ) {
- //check for admins
- // edit this part accordingly to your login needs:
- // maybe you can skip the else statement
- 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', 'daro_login_redirect', 10, 3 );
Add Comment
Please, Sign In to add comment