filters - How to properly modify WP Vary or any existing headers?

admin2025-06-06  1

I have a site that currently have a some part of the headers like:

Vary: Accept-Encoding, Cookie

I want to modify it to be:

Vary: Accept-Language

I tried the suggestions here using this code

add_action( 'send_headers', 'mod_header_test' );
   function mod_header_test() {
   header( 'Vary: Accept-Language' );
}

But the results I'm getting is:

Vary: Accept-Encoding, Accept-Language, Cookie

How do I completely erase the existing Vary header using the correct action/filter and replace it with: Vary: Accept-Language ?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749140013a316702.html

最新回复(0)