Reply
[WordPress] Cannot set cookie, and redirect (header already set)
Old 03-09-2007, 01:25 PM [WordPress] Cannot set cookie, and redirect (header already set)
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 200
Hi,

This is a WordPress 2.1.1 problem.

I have already read How do I solve the Headers already sent warning problem? and attempted that solution.

I am trying to detect these URLs (permalink?c=feed) to set a cookie, and redirect to permalink.

But I get an error saying headers already set by wp-include/link-template.php:3.

PHP Code:
if ($_GET['c'] == "feed") {
$permal the_permalink();
setcookie("feed""read"time()+5400);
header("HTTP/1.1 301 Moved Permanently");
header("Location: $permal");
die; } 
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-09-2007, 02:12 PM Re: [WordPress] Cannot set cookie, and redirect (header already set)
Insensus's Avatar
Ultra Talker

Posts: 275
Name: Mark Stegeman
Location: Netherlands, Europe
That happens a lot. To fix this you should get this code before the code setting the header. Just try to set it before the whole template file.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to [WordPress] Cannot set cookie, and redirect (header already set)
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11085 seconds with 13 queries