I want to logout with browser closing. Actually my account seems logged out in front-end but appears logged-in in back-end.

How can I logged out when I close browser?

  • You'll need to change the lifetime of the authentication cookies to 'session only', You might be able to do that with the auth_cookie_expiration hook, else you can override the function that creates the cookies since it's in pluggable.php.
    – Rup
    Commented Nov 4, 2020 at 10:50
  • I couldn't find it. where it is? I'm not pro of php, so I don't know how can I do it.
    – freedom667
    Commented Nov 4, 2020 at 11:11
  • This isn't possible from WordPress/PHP/HTML/JS, to do it you would need to tell your browser to clear all cookies on close from the browser preferences
    – Tom J Nowell
    Commented Nov 25, 2020 at 12:49
  • the question can close. I fixed it
    – freedom667
    Commented Nov 25, 2020 at 13:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.