Redirect back when enter from specific page.
-
Hello all!
Well I came across a problem I can’t solve.
I have an page, on which user can edit his/her information.
I’d like to include in my “welcome” mail a link to that page, but when you are NOT logged in, it is simply taking you to the wp-login.php and then, when you click login button, redirects you back to edit-profile page.
What I’ve done so far:<?php if ( is_user_logged_in() ) {…} else {wp_redirect( ‘https://www.inakademia.pl/wp-login.php’ );} exit; ?>
and that part works – when i’m not logged in, it sends me off to the wp-login.php
After login button i’ve one more input:
<input type=”hidden” name=”redirect_to” value=”http://www.mysite.com/”>
Which always redirects me to my main site after login. But I want to change that behaviour after like I stated before.
So when you get redirected from mysite.com/profile to wp-login, it should redirect you to mysite.com/profile after sucessfully logging-in.Any ideas? 🙂
- The topic ‘Redirect back when enter from specific page.’ is closed to new replies.