Support Home > WP Super Cache > WP Super Cache FAQ

WP Super Cache FAQ

How to exclude a page from the cache?

If there’s a set of pages that should be excluded from the cache, use the DONOTCACHEPAGE constant:

define( 'DONOTCACHEPAGE', true );

For example, to exclude my-custom-post-type from the cache, you can add this to your functions.php file:

function mytheme_prefix_disable_cache_for_single_page_post_type() {
  if( is_singular('my-custom-post-type') && ! defined('DONOTCACHEPAGE') ) {
    define( 'DONOTCACHEPAGE', true );
add_action( 'template_redirect', 'mytheme_prefix_disable_cache_for_single_page_post_type' );

How to prevent cache clear when adding/updating a post to/from a specific post type?

Note: Works only on versions 1.9.3 or later.

If the Clear all cache files when a post or page is published or updated. option is enabled, the cache gets cleared each time any post/page gets added, updated, or deleted. To prevent that, you can use the wp_super_cache_clear_post_cache filter.

For example, to prevent the cache from getting cleared every time a post from the my-custom-post-type post type gets updated, you can add this to your functions.php file:

add_filter( 'wp_super_cache_clear_post_cache', function ( $clear, $post ) {
  if ( 'my-custom-post-type' === $post->post_type ) {
    return false;

  return $clear;
}, 10, 2 );

How do I know my blog is being cached?

Testing Within WP Super Cache

Go to Settings -> WP Super Cache and look for the “Cache Tester” form on the easy settings page. Click “Test Cache” and the plugin will request the front page of the site twice, comparing a timestamp on each to make sure they match.

Manual Testing

Debug Log

If you want to do it manually, enable debugging in the plugin settings page and load the log file in a new browser tab. Then view your blog while logged in and logged out. You should see activity in the log.

Viewing Page Source

View the source of any page on your site. When a page is first created, you’ll see the text Dynamic page generated in XXXX seconds. and Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS at the end of the source code. On reload, a cached page will show the same timestamp so wait a few seconds before checking.

If Supercaching is disabled and you have compression enabled, the text Compression = gzip will be added. If compression is disabled and the page is served as a static html file, the text “super cache” will be added.

Checking Headers

The only other way to check if your cached file was served by PHP script or from the static cache is by looking at the HTTP headers. PHP cached pages will have the header “WP-Super-Cache: Served supercache file from PHP”. WPCache cached files will have the header, “WP-Super-Cache: Served WPCache cache file”. You should also check your cache directory in wp-content/cache/supercache/hostname/ for static cache files.

If the plugin rules are missing from your .htaccess file, the plugin will attempt to serve the super cached page if it’s found. The header “WP-Super-Cache: Served supercache file from PHP” if this happens. The pagespeed module for Apache may cause problems when testing. Disable it if you notice any problems running the cache tester.

How do I disable Supercaching?

If you only want to use the WP-Cache engine then edit your wp-config.php or create an mu-plugin that sets the constant DISABLE_SUPERCACHE to 1.

WP-Cache vs Supercache files

All cache files are stored in wp-content/cache/supercache/HOSTNAME/ where HOSTNANE is your domain name. The files are stored in directories matching your site’s permalink structure. Supercache files are index.html or some variant of that, depending on what type of visitor hit the blog. Other files are named wp-cache-XXXXXXXXXXXXXXXXX.php. Associated meta filesnames start with “meta”. Those files contain information about the cached file. These files are generated by the “WPCache caching” engine in the plugin.

Will comments and other dynamic parts of my blog update immediately?

Comments will show as soon as they are moderated, depending on the comment policy of the blog owner. Other dynamic elements on a page may not update unless they are written in Javascript, Flash, Java or another client side browser language. The plugin really produces static html pages. No PHP is executed when those pages are served. “Popularity Contest” is one such plugin that will not work.

Will the Super Cache compression slow down my server?

No, it will do the opposite. Super Cache files are compressed and stored that way so the heavy compression is done only once. These files are generally much smaller and are sent to a visitor’s browser much more quickly than uncompressed html. As a result, your server spends less time talking over the network which saves CPU time and bandwidth, and can also serve the next request much more quickly.

How do I make certain parts of the page stay dynamic?

Note: this functionality is disabled by default. You will have to enable it on the Advanced Settings page.

There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That’s what Google Adsense and many widgets from external sites do and is the recommended way. Or you can use a WP Super Cache filter to do the job but you can’t use mod_rewrite mode caching. You have to use the “simple” delivery method or disable supercaching.

WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated HTML.

The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit dynamic-cache-test.php to see the example code.

There are two example functions there. There’s a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn’t matter when serving cached pages. See this post for a more technical and longer explanation.

To execute WordPress functions you must enable the ‘Late init’ feature on the advanced settings page.

How do I delay serving the cache until the “init” action fires?

Cached files are served before almost all of WordPress is loaded. While that’s great for performance it’s a pain when you want to extend the plugin using a core part of WordPress. Enable ‘Late init’ mode on the Advanced settings page and cached files will be served when “init” fires. WordPress and it’s plugins will be loaded now.

Why don’t WP UserOnline, Popularity Contest, WP Postratings or plugin X not work or update on my blog now?

This plugin caches entire pages but some plugins think they can run PHP code every time a page loads. To fix this, the plugin needs to use Javascript/AJAX methods or the wpsc_cachedata filter described in the previous answer to update or display dynamic information.

Why do my WP Super Cache plugins disappear when I upgrade the plugin?

WordPress deletes the plugin folder when it updates a plugin. This is the same with WP Super Cache so any modified files in wp-super-cache/plugins/ will be deleted. You can put your custom plugins in a different directory in a number of ways. You can define the variable $wp_cache_plugins_dir in wp-config.php or wp-content/wp-cache-config.php and point it at a directory outside of the wp-super-cache folder. The plugin will look there for it’s plugins. Or if you distribute a plugin that needs to load early you can use the function wpsc_add_plugin( $filename ) to add a new plugin wherever it may be. Use wpsc_delete_plugin( $filename ) to remove the plugin file. See #574 or this post on writing WP Super Cache plugins.

What does the Cache Rebuild feature do?

When a visitor leaves a comment the cached file for that page is deleted and the next visitor recreates the cached page. A page takes time to load so what happens if it receives 100 visitors during this time? There won’t be a cached page so WordPress will serve a fresh page for each user and the plugin will try to create a cached page for each of those 100 visitors causing a huge load on your server. This feature stops this happening. The cached page is not cleared when a comment is left. It is marked for rebuilding instead. The next visitor within the next 10 seconds will regenerate the cached page while the old page is served to the other 99 visitors. The page is eventually loaded by the first visitor and the cached page updated. See this post for more.

Why doesn’t the plugin cache requests by search engine bots by default?

Those bots usually only visit each page once and if the page is not popular there’s no point creating a cache file that will sit idle on your server. However you can allow these visits to be cached by removing the list of bots from “Rejected User Agents” on the Advanced settings page.

Why is a category page is showing instead of my homepage?

A tiny proportion of websites will have problems with the following configuration:

  1. Uses a static page for the front page.
  2. Uses /%category%/%postname%/ permalink structure.

Sometimes a category page is cached as the homepage of the site instead of the static page. I can’t replicate the problem but a simple solution is to use the “Simple” mode. You can also enable “Extra homepage checks” on the Advanced Settings page.

Why do I get warnings about caching from ?

“Your blog doesn’t support client caching (no 304 response to If-modified-since).” “Your feed doesn’t support caching (no 304 response to If-modified-since)”

Supercache doesn’t support 304 header checks in Expert mode but does support it in Simple mode. This is caching done by your browser, not the server. It is a check your browser does to ask the server if an updated version of the current page is available. If not, it doesn’t download the old version again. The page is still cached by your server, just not by your visitors’ browsers. Try the Cacheability Engine at or for further analysis.

How should I best use the utm_source tracking tools in Google Analytics with this plugin?

That tracking adds a query string to each url linked from various sources like Twitter and feedreaders. Unfortunately, it stops pages being supercached. See Joost’s comment here for how to turn it into an anchor tag which can be supercached.

Why does the plugin plugin complain that wp-content is writable? It also says htdocs is writable?

It’s not good when the web server can write to these directories but sometimes shared hosting accounts are set up in this way to make administration easier. Use chmod 755 directory to fix the permissions or find the permissions section of your ftp client. This Google search will lead you to more information on this topic and there’s also this codex page too. Unfortunately some hosts require that those directories be writable. If that’s the case just ignore this warning.

How do I delete the WP_CACHE define from wp-config.php?

Load your desktop ftp client and connect to your site. Navigate to the root (or the directory below it) of your site where you’ll find wp-config.php. Download that file and edit it in a text editor. Delete the line define( 'WP_CACHE', true ); and save the file. Now upload it, overwriting the wp-config.php on your server.

How do I delete the Super Cache rules from the .htaccess file?

oad your desktop ftp client and connect to your site. You may need to enable “Show hidden files” in the preferences of the ftp client. Navigate to the root of your site where you’ll find the .htaccess file. Download that file and edit it in a text editor. Delete the lines between # BEGIN WPSuperCache and # END WPSuperCache and save the file. Now upload it, overwriting the .htaccess file on your server.

How do I change file permissions?

This page on the WordPress Codex explains everything you need to know about file permissions on your server and various ways of changing them.

Why do I get load spikes when new posts are made?

You may have the “clear all cached files when new posts are made” option set. Clearing those files can take time plus your visitors will now be visiting uncached pages. Are you using Google Analytics campaign tracking with utm_source in the url? Those pages aren’t cached. See the question, “How should I best use the utm_source tracking tools in Google Analytics with this plugin” above for how to use them properly. Cached pages have to be refreshed when posts are made. Perhaps your server just isn’t up to the job of serving the amount of traffic you get. Enable the “cache rebuild” feature as that may help.

How many pages can I cache?

The only real limit are limits defined by your server. For example, EXT2 and EXT3 allow a maximum of 31,999 sub directories so if you have a flat permalink structure (like /%POSTNAME%/) and more than 32,000 posts you may run into problems. Likewise, if you run a multisite network and have more than 31,999 sites (blogs) you won’t be able to cache all of them. Realistically if you had that many active sites you wouldn’t be running on one server.

I can see that the www version of my site is cached separately. How do I stop that?

WordPress should redirect to the canonical URL of your site but if it doesn’t, add this to your .htaccess above the Supercache and WordPress rules. Change to your own hostname.

RewriteCond %{HTTP_HOST}$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

How do I serve cached mobile pages to clients on small screens like phones and tablets?

Your theme is probably responsive which means it resizes the page to suit whatever device is displaying the page. If it’s not responsive, you’ll have to use a separate mobile plugin to render a page formatted for those visitors. The following plugins have been tested but YMMV depending on mobile client. You’ll have to enable mobile browser support as well on the Advanced settings page.

  • Table Of Contents

  • Categories

  • Contact Us

    Need more help? Feel free to contact us.