• aleksandersen

    (@aleksandersen)


    Hi,

    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.

    if ($_GET['c'] == "feed") {
    $permal = the_permalink();
    setcookie("feed", "read", time()+5400);
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $permal");
    die; }
  • The topic ‘Cannot set cookie, and redirect (header already set)’ is closed to new replies.