Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I can see two cookies: auth and login cookies in wordpress. Why do we need two? I think one is enough.

share|improve this question

3 Answers 3

up vote 4 down vote accepted
+50

"On login, wordpress uses the wordpress_[hash] cookie to store your authentication details. It's use is limited to the admin console area, /wp-admin/

After login, wordpress sets the wordpress_logged_in_[hash] cookie, which indicates when you're logged in, and who you are, for most interface use.

Wordpress also sets a few wp-settings-{time}-[UID] cookies. The number on the end is your individual user ID from the users database table. This is used to customize your view of admin interface, and possibly also the main site interface."

When in doubt, check the Codex first.

share|improve this answer
    
when I ask this question, there isn't a doc like now in wordpress codex :( –  lovespring Jun 8 '12 at 17:04
    
That page has been there since 6/21/05 - codex.wordpress.org/… (login to wordpress.org needed) and hasn't been altered for nearly 3 months. –  SickHippie Jun 11 '12 at 20:55

I believe the two cookies are to do with SSL. When using the admin area you want it secure and so you cannot have the authentication cookie details always presented to everyone on your site (such as non-SSL connections). However there are times you want to be known as logged in but not using the secure connection. So by separating them you can edit your site with the auth cookie details and remain logged in across the entire site with the logged in cookie.

http://codex.wordpress.org/WordPress_Cookies

share|improve this answer

Here is Ryan Boren (a lead Wordpress developer) explaining why the cookies are split.

http://ryan.boren.me/2008/07/14/ssl-and-cookies-in-wordpress-26/

share|improve this answer
    
Link only answers, even from reputable sources, are discouraged. If something happens to that link this answer becomes useless. Please try to make the answer here stand alone. –  s_ha_dum Feb 1 at 4:54

Your Answer

 
discard

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.