HOW TO ADD LOGOUT REDIRECT TO HOME PAGE AT WOOCOMMERCE ACCOUNT

HOW TO ADD LOGOUT REDIRECT TO HOME PAGE AT WOOCOMMERCE ACCOUNT

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

Simple add those codes to your theme’s functions.php file which is located in under Appearance >>Theme Editor>> Themes’s function.php

add_action('wp_logout','auto_redirect_after_logout');

function auto_redirect_after_logout(){

  wp_redirect( home_url() );
  exit();

}

By default, WooCommerce redirects users to the “my account” page after registration, login, and logout. This codes allows you to redirect users to custom pages and URLs such as “home,” “offers,” “catalog,” the previous page, or any external link

Share on facebook
Share on google
Share on twitter
Share on linkedin
Monjur Ahmed

Monjur Ahmed

I'm Monjur Ahmed ! Currently Studying Computer Science & Engineering at City University of Bangladesh.

Leave a Replay

Sign up for our Newsletter