I've got a login/logout link using wp_loginout(). After a user logs out their user info is still being shown by get_currentuserinfo(), only after they visit a second page does it revert to not showing any user info. They are, however actually, logged out after the initial logout (as they can't access any protected pages).

If I disable the plugin I don't experience this issue. How can I ensure that when a user logs out the change is reflected without having to visit a second page?


  • That's not an "issue", that's a "feature"! :D No, I'm not joking. You've to care about stuff like this for yourself. Btw: Is it the default login, or AJAX-powered? – kaiser Apr 20 '12 at 3:02
  • It's the default login. – Sandbox Wizard Apr 20 '12 at 3:06
  • @SandboxWizard Have you checked Don't cache pages for logged in users option under page cache settings? If not, check it. – its_me Apr 20 '12 at 6:58
  • That option is checked. – Sandbox Wizard Apr 20 '12 at 13:49
  • Try nuking the logged in cookie in the logout page... – Joshua May 23 '12 at 23:11

As the commenters have alluded to, this is a "feature" of using cookies. Changes to cookies are only enacted on the next page refresh.

You could try adding an extra page refresh (which will make the users browser page flash) or you could add some JavaScript to destroy the cookie dynamically.


Try to not cache the home page and also click on the checkbox to disabled caching for login/logout pages. I encountered the same issue with my site http://www.techflict.com, It got resolved after disabling caching for home page. Hope this helps...:)

Not the answer you're looking for? Browse other questions tagged or ask your own question.