// ROJO'S CUSTOM CODES // Redirect to /Dashboard page after signing in function redirect_login_page() { $login_page = home_url( '/login/' ); $page_viewed = basename($_SERVER['REQUEST_URI']); if( $page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') { wp_redirect($login_page); exit; } } add_action('init','redirect_login_page'); function login_redirect( $redirect_to, $request, $user ){ //is there a user to check? if (isset($user->roles) && is_array($user->roles)) { //check for admins if (in_array('administrator', $user->roles)) { //Redirect them to the default place return admin_url(); } else { return home_url( '/dashboard/'); } } else { return $redirect_to; } } add_filter('login_redirect', 'login_redirect', 10, 3); // Redirect /signin to /login function custom_redirect_signin_to_login() { if ( strpos( $_SERVER['REQUEST_URI'], 'signin' ) !== false ) { wp_redirect( home_url( '/login' ) ); exit; } } add_action( 'init', 'custom_redirect_signin_to_login' ); // Redirect /signup to /register function custom_redirect_signup_to_register() { if ( strpos( $_SERVER['REQUEST_URI'], 'signup' ) !== false ) { wp_redirect( home_url( '/register' ) ); exit; } } add_action( 'init', 'custom_redirect_signup_to_register' ); // Redirect users to the base URL after logging out function custom_logout_redirect() { wp_redirect( home_url() ); exit(); } add_action( 'wp_logout', 'custom_logout_redirect' );