Cannot set cookie, and redirect (header already set) (1 post)

  1. Aleksandersen
    Posted 9 years ago #


    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; }

Topic Closed

This topic has been closed to new replies.

About this Topic