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.