How to Redirect WordPress Back to Referring Page After Login?
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

Vinoth Kumar
Related Posts
Leave a Reply Cancel reply
You must be logged in to post a comment.
Categories
Recent Posts
- The Benefits of Using Shell Stalls for Your College Events, Conferences, and Seminars
- Looking for octanorm exhibition stall for rent in Coimbatore
- The Top Rated Stall Fabrication Company in Chennai
- Find the Best Website Designers in Coimbatore Now!
- 7 Tips for Effective Event Management
- Exhibition Stall Fabrication In Coimbatore, India
- Ad Film Director | Ad Film Makers in Coimbatore, India – 2022
- Best Event Management Company In Coimbatore – Orange Art Factory
- Easy way to lose weight fast
- Website Designers in Coimbatore – Vinoth Kumar – ODC
