Skip to main content
12 events
when toggle format what by license comment
Jan 27, 2013 at 3:46 answer added Andrew timeline score: 3
Jan 27, 2013 at 3:05 history edited Andrew CC BY-SA 3.0
deleted 95 characters in body
Jan 27, 2013 at 2:58 history edited Andrew CC BY-SA 3.0
updated question to better reflect current problem of not being able to read the cookie
Jan 27, 2013 at 2:31 comment added Andrew @Milo one step closer now. I reverted back to Twenty Twelve but kept only my plugin (it has the example code in this question in it). Now I don't need to be logged into the admin for the cookie to be set, but I cannot output the value of the cookie on the page using my function above, until I log into the admin. So still something weird going on...
Jan 27, 2013 at 2:19 comment added Milo the only other thing I can guess is that output is being sent before you set the cookie. have you tried this with no plugins and unaltered default theme?
Jan 27, 2013 at 2:06 comment added Andrew It's almost like I need to be authenticated before it will allow any cookies to be set. Could this be a server setting?
Jan 27, 2013 at 2:04 comment added Andrew @Milo I'm aware that the cookie is not set until the next page refresh but that's not the issue I'm facing. I've just tried my code in the theme's functions.php instead of plugin and same issue.
Jan 27, 2013 at 2:01 comment added Milo $_COOKIE is set at the beginning of a request, if you're trying to access the value in $_COOKIE in the same request as the call to setcookie, it won't exist until the next request.
Jan 27, 2013 at 1:55 history edited Andrew CC BY-SA 3.0
deleted 30 characters in body
Jan 27, 2013 at 1:55 comment added Andrew @Milo I saw these in another example on settings cookies with WordPress. I've updated my question with these constants removed. I still have the same issue though, just can't work out why the cookie is only set after I log in to the admin.
Jan 27, 2013 at 1:46 comment added Milo you don't have to be, it's probably your use of the COOKIEPATH and COOKIE_DOMAIN constants that's causing the issue. why are you using them and what are they set to? you normally don't need these unless you have an unusual configuration.
Jan 27, 2013 at 0:37 history asked Andrew CC BY-SA 3.0