How to fix wp-super-cache 0 Cached Pages
How to fix wp-super-cache 0 cached pages issue
Today I stumble upon an issue which I was seeing for some time now, I had no idea why on each browser request it will always need to wait for almost a second on a normal “cached” (at the time thought it was cached) static page. Later I found out that it was actually an issue with wp-super-cache which didn’t actually generated any cached pages.
I tried removing everything manually (as automatically had no effect) exactly how it explains on the uninstall guide:
- Turn off caching on the plugin settings page and clear the cache.
- Deactivate the plugin on the plugins page.
- Remove the WP_CACHE define from wp-config.php. It looks like
define( 'WP_CACHE', true );
- Remove the Super Cache mod_rewrite rules from your .htaccess file.
- Remove the files wp-content/advanced-cache.php and wp-content/wp-cache-config.php
- Remove the directory wp-content/cache/
- Remove the directory wp-super-cache from your plugins directory.
Afterwards tried to install the plugin back to be able to use it, however the response back was really the same, 0 cached pages.
I then started looking at another installation I had on the same cpanel account which was working great, luckily I did fixed this in the past, but I tend to forget things a lot so since I didn’t write it or note it, I had to find the solution again.
Also, it didn’t really linked only to wp-super-cache, w3-total-cache also had “approximately” the same issue, only this plugin has a more “forced” browser cache options which didn’t helped me seeing the actual issue.
By luck I thought of checking the wp-settings.php file, I’m not sure exactly why, but I did remembered the last fixed was related to this file. So did compared this file to a working site and I found out that it was missing the line:
// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
if ( WP_CACHE )
WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
The above line needs to be added right *after* the line:
// Check if we're in WP_DEBUG mode.
Save the file, go back to wp-super-cache and click the Contents tab, by now it should be working, and cache files should be generated. I also noticed a nice feature which is really great for websites that has fewer posts. This is called Preload.
From the Preload section description (which I agree):
This will probably help your Google ranking as they are using speed as a metric when judging websites now.
It should be noted though, most shared hosting provided have inode limits, with over 10,000 posts, you will use at least 10,000 inodes. May not be a good idea to just use them like this.