• hello.

    googled everywhere, checked any relevant post on the support forum I could, tried everything, setcookie() used at the beginning, no whitespaces, var_dump(headers_sent()) false, etc.: setcookie() just doesn’t work.

    or at last, it worked once, then reloading the page it just did not work anymore.

    setcookie('my_cookie', time(), time()+(3600*24), COOKIEPATH, '.example.com', false);

    I used time() as value to check that the cookie was actually set again as I reload the page, and here I replaced the real domain with example.com.

    I need just a plain answer: is it intended as possible to set your own custom cookies on wordpress, yes or not?

    if yes, what am I doing wrong?

    well, that would be two plain answers, but I hope I’ll have them anyway.

    many thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lucaboccianti

    (@lucaboccianti)

    using session variables I sort of obtained what I wanted, still I’d have preferred to use cookies because I could leave them set for longer than session vars. with sessions the user need to re-enter a code every time s/he turn off the browser or the computer, while I would have preferred to leave a cookie lasting say a week.

    I’m still very interested in wordpress and cookie, anyway.

    Thread Starter lucaboccianti

    (@lucaboccianti)

    thanks kmessinger, but if I’m not wrong that function can be used only when dealing with registered users and not with anonymous ones.

    for several reasons, on the website I’m working it was decided that the users could/should stay anonymous.

    what I need is for a casual user to enter a given password on a form and then having this password stored on a cookie or on a session var to avoid to ask him/her the pw again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘setcookie() definitely not working (searched/read/tried everything)’ is closed to new replies.