简体   繁体   中英

Woocommerce Logout/How to make custom logout

I would like to make a logout feature on my webpage. How can I do this when the user is only logged in have a logout feature adn successfully logout? Is there a plugin or something or some code I can insert somewhere?

 include 'config.php';
 session_start();
 $_SESSION['SESS_MEMBER_ID'] = false;
 $_SESSION['SESS_FIRST_NAME'] = false;   
 $_SESSION['username']=false;
 session_destroy();   
 header("Location:index.php");

Step1: Create logout link

Step2: check the session variable for this link show it only if session exist

step3: click on logout

 function logout(){
          session_destroy();
          header("Location:login.php");
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM