Modify wp headers on specific page
I'm trying to change the cache-control header of a specific post (1234). I tried adding the following to the end of my functions.php:
add_filter('wp_headers', 'wp_test_headers');
function wp_test_headers($headers)
{
if ( is_single ( 1234) ) {
$headers['Cache-Control']="no-store, no-cache, must-revalidate, max-age=0";
}
return $headers;
}
However when I open the page of the post in my browser, the condition is never met. Should I be adding the filter elsewhere, or is there another issue?