Help Pinpointing Source of Caching Issue

You may need to set nocache headers in your main template header. Include this near the top of the header.php after the opening tag: nocache_headers()

From here: Function Reference/nocache headers

Run some tests, I believe this should only affect the main page file, other files should still cache normally.

More idealy, wordpress should be sending a last modified header with the home page. Hold on while I dig further into this.

Notice the cache-control max-age. As you can see, the cache has been set at 30 days. Meaning the browser will assume nothing has changed for 30 days unless the server sends a different header.

HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.45
Cache-Control: public, max-age=2592000
Expires: Wed, 22 Mar 2017 01:15:09 GMT
Content-Type: text/html; charset=UTF-8
Link: <http://zilredloh.com/wp-json/>; rel="https://api.w.org/"
Link: <http://wp.me/1ZLfW>; rel=shortlink
Vary: Accept-Encoding
Date: Mon, 20 Feb 2017 01:15:09 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Connection: close
Content-Length: 85258

After adding the code:

Notice the second set of Cache Control and Expires.

HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.45
Cache-Control: public, max-age=2592000
Expires: Wed, 22 Mar 2017 02:01:16 GMT
Content-Type: text/html; charset=UTF-8
Link: <http://zilredloh.com/wp-json/>; rel="https://api.w.org/"
Link: <http://wp.me/1ZLfW>; rel=shortlink
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Vary: Accept-Encoding
Date: Mon, 20 Feb 2017 02:01:16 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Connection: close
Content-Length: 85258

Leave a Comment