WordPress.org

Ready to get started?Download WordPress

Forums

wp2.5 deleting cookies (6 posts)

  1. shua
    Member
    Posted 6 years 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.

    thoughts???

    Does wp2.5 destroy session cookies? domain cookies etc?

  2. shua
    Member
    Posted 6 years ago #

    Here is another example of my use of cookies.

    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.

    Please help.

  3. shua
    Member
    Posted 6 years ago #

    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

    <?php if(is_page('2')){
         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?!?

  4. shua
    Member
    Posted 6 years ago #

    Any thoughts?

  5. fabio69
    Member
    Posted 6 years ago #

    I have the same trouble. When I open a new window using javascript window.open('http://mysite/myfile.php'), the session is lost.

    In myfile.php, is_user_logged_in() return false

    Amazingly the same code works in localhost

    please help

  6. shua
    Member
    Posted 6 years 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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags