WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an easy way to see if a user - someone how has logged in in the past but is not currently logged in - is visiting my site?

I was thinking that checking if $COOKIE[TEST_COOKIE] is set, but I am uncertain.

  1. Is this a good method?
  2. Is there a better cookie to check for?
  3. What would you do?
share|improve this question
Hmmm ... TEST_COOKIE seems to disappear when session is over. Probably not a good idea. What do you think about checking to see if $COOKIE is not empty might be a better method as the wp-settings-time-* cookie seems to stick around for a year. – mfields Jul 5 '11 at 13:11
Are you using $COOKIE or $_COOKIE? – EAMann Jul 5 '11 at 15:30
Was doing it right in the code ... not sure where the underscore went? I've abandoned this though. – mfields Jul 5 '11 at 16:41

You could check for this cookie wp-settings-1 it lasts for 1 day and then also check if wordpress_test_cookie is available. Or you could just write a simple plugin that checks if the user is logged in and adds a longer term cookie to check against.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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