Support » Themes and Templates » wp2.5 deleting cookies
8 years, 4 months ago
I display conditional content if a user has a specific cookie set.
My code has been working for the past year +, but not after an upgrade to 2.5.1.
It looks as if the cookie is set – but when navigating to another page it is destroyed.
Does wp2.5 destroy session cookies? domain cookies etc?
When a user fills in a form I set a cookie for each field.
When the user navigates to a different form on the site, the fields are pre-populated.
In wp2.5 the cookie is deleted or lost or destroyed – it is gone.
I went ahead and created a fresh install of wp2.5.1 with a brand new db. I created some pages and posts and added a bit of cookie code.
When navigating to a page with the id of 2 I do this in the header.php
setcookie("myName", 'shua', time()+36000);
pretty straight forward stuff.
I then see if the cookie was set using the ‘Cookies’ menu item in FF WebDeveloper extension. Low and behold… it is there.
I them navigate away from that page, to a page with id 3. I once again look at my cookies… gone.
What is going on???
Cookies are turned on, they are set to expire in 10 hours – and cookies from other sites persist?!?
In myfile.php, is_user_logged_in() return false
Amazingly the same code works in localhost
8 years, 2 months ago
you must NOW set the domain for the cookie for it to not be destroyed – a big undocumented change from prior 2.x versions.