[wp-hackers] Cookie Help

Ryan Bilesky rbilesky at gmail.com
Thu Sep 2 22:40:10 UTC 2010


I am writing a custom function for my theme that uses a free api to get
location information for an IP.  But its giving me this error

Warning: Cannot modify header information - headers already sent by (output
started at
/home/ryanbile/public_html/dev/wp/content/themes/1.0/header.php:3) in *
/home/ryanbile/public_html/dev/wp/content/themes/1.0/functions.php* on line
*124*

Basically I check to see if the user has a geoip cookie, if not query the
api and store the results in a cookie (on line 124) to avoid making lots of
api calls, if the cookie was already set my function just returns the
cookies value.  How do I get around this headers already sent error.  Sorry
for the simple question, I just never worked with cookies before

You can see my code at http://pastebin.com/pXq5gcmj


More information about the wp-hackers mailing list