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 Top 3 Exhibition Stall Fabricators in Hyderabad in 2024
- Looking for the Best Exhibition Stall Fabricator in Hyderabad? Here’s Why Orange Exhibition Stall Fabrication is Your Go-To Choice
- “Acting Chance in Tamil Movies: Kickstart Your Career in the Tamil Film Industry”
- Zoya Exhibitions and Stand Fabrications: Launching Operations in Dubai
- 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