• In which file or where wordpress adds “cache-control” header?
    I disabled all my plugins to find out the reason of some headers, and discovered that WordPress always adds cache-control: no-cache header.

    This post recommends filter for wp_headers, but i prefer to just remove it from wordpress code file to do not spend CPU for filters.
    Also, this solution not working for me on latest wordpress.

    I need to configure my headers in my own way so how to prevent wordpress from adding it, in which file it is set?

Viewing 1 replies (of 1 total)
  • Thread Starter Marcus Pearson

    (@crackhd)

    In git repo i’ve searched for this http header.
    Filter name has changed. Correct code for this hack:

    add_filter('nocache_headers', 'wpfck_nocache', 99, 1);
    function wpfck_nocache($headers)
    {
        unset($headers['Cache-Control']);
        unset($headers['Expires']);
        unset($headers['Pragma']);//carefully
        return $headers;
    }

    If you need to wipe it out just modify function at wp-includes/functions.php:1024

Viewing 1 replies (of 1 total)
  • The topic ‘Prevent wordpress setting Cache-Control HTTP header’ is closed to new replies.