How to send a cookie to the browser.
-
Ok, so I have the code :
function set_my_cookie(){ setcookie('my_cookie', '2011', 8600, '/', get_bloginfo('url')); //set the cookie }
This is attached as a hook to wp_head
add_action('wp_head', 'set_my_cookie');
.It doesn’t works since wp_head() is called after some output is sent to the bowser and I am supposed to set the cookie BEFORE any output is sent.
So what hook can I use to make it work?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to send a cookie to the browser.’ is closed to new replies.