How can I change the redirect path after logout

This topic has 4 replies, 2 voices, and was last updated 1 years, 5 months ago ago by Dewruwan95

  • Avatar: Dewruwan95
    Dewruwan95
    Participant
    October 28, 2022 at 16:54

    I want to redirect my page to the home page after logout from the site. can I do it in XStore

    3 Answers
    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    October 29, 2022 at 05:14

    Hello, @Dewruwan95,

    By default, there is no such Option in our Theme or WooCommerce for it, but you can achieve it using the Custom Code, you can add the Code under the Child Theme functions.php file and it will work for you, I have tested that code too on my test site: https://stackoverflow.com/questions/54875491/woocommerce-my-account-logout-and-redirect-to-homepage

    add_action('wp_logout','auto_redirect_after_logout');
    function auto_redirect_after_logout(){
      wp_redirect( home_url() );
      exit();
    }

    Regards 8Themes Team.

    Avatar: Dewruwan95
    Dewruwan95
    Participant
    October 29, 2022 at 10:50

    Can you please help me to find the path of the functions.php file and where to place the code in the code file?

    Avatar: Dewruwan95
    Dewruwan95
    Participant
    October 29, 2022 at 12:07

    I found it. Thank you

  • Viewing 4 results - 1 through 4 (of 4 total)

The issue related to '‘How can I change the redirect path after logout’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.