How to Fix the “Specify a Cache Validator” Warning in WordPress

Are you seeing the “Specify a cache validator” warning in Pingdom, GTmetrix, or Google PageSpeed Insights on your WordPress site? This is due to missing HTTP caching headers which should be included on every origin server response, as they both validate and set the length of the cache. If the headers aren’t found, it will generate a new request for the resource every time, which increases the load on your server. Utilizing caching headers ensures that subsequent requests don’t have to be loaded from the server, thus saving bandwidth and improving performance for the user. The warning from Pingdom states:
The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources.
Follow the steps below on how to fix the “Specify a cache validator” warning.
Fix the “Specify a cache validator” Warning
The first thing that is important to note about this warning is that you can only fix this for requests that are on your server. If you have 3rd party requests you are seeing this on, there