• Hi,

    I need to remove the set-cookies field from the http response before the server sends it to the browser using “wp_headers” hook.

    I used the below code. It doesn’t work.

    When i tried to print the ” $headers ” varaible i found that there are only two elements in the array i.e content-type and charset

    Got this when i tried to print the headervalue :
    Array ( [Content-Type] => text/html; charset=UTF-8 )

    The code i tried :
    function remove_headers($headers) {
    print_r($headers);
    //code to remove set-cookie
    return $headers;
    }
    add_filter( ‘wp_headers’, ‘remove_headers’);

    I think the hook runs before set-cookies is set to the response headers. May be delaying it to run after that may solve the problem.

    Thanks for your help in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Remove set-cookie field from http response headers’ is closed to new replies.