WordPress Site Health - Caching
This article will cover the range of warnings that the WordPress Site Health Check will show regarding caching, as well as how best to rectify these when they occur.
Persistent Object Caching
One of the most common reasons is that the site lacks a persistent object cache. Persistent Object Caching is an additional component to the WordPress infrastructure designed to improve the performance of a WordPress site by reducing the need to repeatedly query the database.
This form of caching is not required on all sites, but can be a valuable addition. Persistent object caching is not available on our Shared Hosting, unfortunately, and you will instead need a WordPress Optimised Managed 20i Cloud hosting server. We have another article based on Persistent Object caching and how this can be implemented on your site.
WP_CACHE is set to fale
Another common reason for the WordPress Site Health Cache warning showing is the fact that WP_CACHE is set to false. This is an option that can be set in your wp-config.php or wp-settings.php files. This can be useful if you are developing the site and do not want it to be cached to have any changes reflect immediately. However, on a live production site, it is recommended that you either remove this or set it to 'true' to ensure that your WordPress site can be cached.
Unable to detect the presence of page cache
Another error that can be seen is that the WordPress site is 'Unable to detect the presence of page cache'. The WordPress health check works by checking for certain HTTP Headers to detect the presence of cache. These are:
cache-control, expires, last-modified, x-cache-enabled, x-cache-disabled
If the caching service you are using does not use the above, then it is possible that WordPress will be unable to detect this. For example, our caching uses: x-stackcache-cacheable, x-cdn-cache-status, x-origin-cache-status . If you are unsure as to whether your site is caching, then you can check the HTTP Headers on your site manually and look for any cache 'HITs'.
"Page cache is detected, but the server response time is still slow"
The final common reason that the WordPress site health check will report regarding caching, is the fact that Page Caching is indeed detected, but the server response is still slow.
In this case, your site is caching as expected, but the response time itself is slow. This can be due to the server itself being under considerable load and traffic, leading to the slow response and load times. Alternatively, this error can also be due to a range of site-related issues. If you see this, we recommend you make sure that your WordPress install, plugins, and themes are all up-to-date, as these are all factors that can slow down the response time of your site.