redirection after connection
-
Hello
I come back to you again … because I absolutely have to find a way to redirect a user to the previous page after login. I tried this code but without successadd_action( 'wp', 'get_before_login_url' ); function get_before_login_url(){ if( !is_user_logged_in() ): $_SESSION['referer_url'] = get_the_permalink(); endif; }
/*@ After successful login redirect */ if( !function_exists('after_login_redirect') ): function after_login_redirect() { $redirect_url = home_url('/'); if ( isset($_SESSION['referer_url']) ): $redirect_url = $_SESSION['referer_url']; unset( $_SESSION['referer_url'] ); endif; return $redirect_url; exit; } add_filter('login_redirect', 'after_login_redirect'); endif;
`
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘redirection after connection’ is closed to new replies.