• Hi there, how can we redirect to homepage on logout?
    I tried adding this on theme functions but it just goes to the member-login page

    add_action('wp_logout','auto_redirect_after_logout');
    
    function auto_redirect_after_logout(){
      wp_safe_redirect( home_url() );
      exit;
    }
    • This topic was modified 4 years, 1 month ago by bttmrc.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @bttmrc,

    Our plugin wraps the normal wp_logout function with our own (in order to allow for setting a different sign in page), but we provide a filter for the redirect url.

    
    add_filter('yikes-custom-login-logout-redirect-url','auto_redirect_after_logout');
    
    function auto_redirect_after_logout(){
      return home_url();
    }
    

    Let me know if that helps,
    Jon

    bln49030

    (@zino49)

    Hey @jpowersdev ,

    i have the same problem, i want to redirect the user to an exxternal domain. I have pasted your code in the functions.php but it didnt worked.

    greetings
    Zino

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect on logged out’ is closed to new replies.