Logging out takes me to website base url. Can i change it? [RESOLVED]

Hi all,

I use gravity forms and I added a login box. (https://onboarding.gvc.tax/) It works fine if it is on my home page but when I log out it takes me back to the home page (base URL) I want to add the login box in a sub-page but how would I make it so when people log out they are redirected again to this sub page and not the base URL?

Thank you!

Hello Apostolos. It looks like you can do this with the WordPress wp_logout filter (not Gravity Forms):

function redirect_after_logout_8469(){
  wp_redirect( 'https://example.com/your-url/' );

Thank you Chris. Will this redirect all logouts to this page I set?

I need to have multiple log-in pages under many URLs . for example
www.myurl.com/firstloginpage - one login form
www.myurl.com/secondloginpage - another login form

so each login page’s logout should redirect to that page accordingly. Will this code work for this?

Thank you very much

Hi Apostolos. Going back to your original request, you want to have the user stay on the same page as they were when they clicked the ‘log out’ link, is that correct?

Thank you for your reply.
Yes exactly. And the login forms will be in more than one URL addresses on the website but when they log out I would like them to go to the same page where the log out link was.

In that case, I think this is what you need:

You will need to edit the code to handle log out (that example handles redirection after logging in.)

Yes, that seems to be exactly what I was looking for!
Thank you very much for your help.
I am very happy to work with gravity forms. Its very versatile!

Thanks again

Thank you Apostolos. Cheers!

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.