WooCommerce - My Account - logout and redirect to Homepage

Rich72 picture Rich72 · Feb 25, 2019 · Viewed 10k times · Source

Once a user is in their My Account page on WooCommerce I'd like them to hit logout and be redirected to my Homepage rather than end up on the login page.

Answer

mujuonly picture mujuonly · Feb 26, 2019
add_action('wp_logout','auto_redirect_after_logout');

function auto_redirect_after_logout(){

  wp_redirect( home_url() );
  exit();

}