User Session and Stored Cookies not get removed

Question

I am using below code to remove the user session, cookies etc, but its not working. Please help me to resolve this issues

  $userid = get_current_user_id(); //get current user id
  sleep(30); //to wait for 30 sec
  unset( $_COOKIE[$current_user] );
  setcookie( $userid, '', time() - (5) );
  wp_destroy_current_session([$userid]);
  wp_clear_auth_cookie();
  exit;
  wp_logout();

I am using this code in custom develop plugin.

0
, , , , Amar Verma 3 years 2020-03-28T12:51:04-05:00 0 Answers 116 views 0

Leave an answer

Browse
Browse