Do you want to redirect users back to the page they were viewing after logging in? While there’s probably a plugin for this, but I came thru a link where I found this instruction. It works all fine for me. Anyone who wants to redirect users to the same page they were viewing use this instruction.

Instructions:

All you have to do is add this code to your theme’s functions.php.

if( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) ) {add_filter('login_redirect', 'my_login_redirect', 10, 3);functionmy_login_redirect() {$location= $_SERVER['HTTP_REFERER'];wp_safe_redirect($location);exit();}}

That’s it!

Comment for more details.

Source: https://www.isitwp.com/redirect-back-to-referring-page-after-login/

For my other blogs Click Here

old dream creation