• Dear All,

    Appreciate if you could step by step guide me on how to allow users to stay on the current page after they logged out?

    My requirement is i have 2 pages as https://www.elead.lk/persona and https://www.elead.lk/yourname. The users who log in to persona site when they logout they should direct the persona page whilst the yourname site users are on the yourname site when they log out. Now whats happen is they all are redirecting to https://www.elead.lk home page.

    If i can insert two buttons and include two seperate URLs to the button and make them redirecting to their respective pages that would be great.

    If not atleast i can allow them to that in their current pages after they logged out it will be also fine.

    As i’m not sure of changing a coding or php files appreciate you could guide me step by step or withthe use of code snippets plguin.

    Thank you so much !!!

    Really appreciate your guidance….

    • This topic was modified 4 years, 2 months ago by kushd.
    • This topic was modified 4 years, 2 months ago by kushd.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    If you’re able to edit the logout URL used (likely possible if you are inserting logout buttons), add a “redirect_to” query argument along with the desired destination URL to the logout URL. You want something like:
    https://example.com/wp-login.php?action=logout&redirect_to=https://example.com/persona/

    One way to get such an URL is to call wp_logout_url( $redirect ), passing the desired destination URL as $redirect.

    A different method, which would actually override the above mentioned method if both were to be used, is to hook the ‘logout_redirect’ filter. Have the filter callback return the desired destination URL.

Viewing 1 replies (of 1 total)
  • The topic ‘Logout and stay in current page’ is closed to new replies.