WP Super Cache Developer Documentation

I’ve finally found the time to write up some documentation for developers who want to work with WP Super Cache.

It’s a work in progress but should help other plugin developers who want to interact with the cache.

Suggestions and comments welcome.

PS. If you’re in Cork on November 14th, head along to BarCamp Cork III. I’ll be giving a talk, “How WP Super Cache Works”. It’ll be less technical than this but I’ll answer questions too. Check out the other sessions too.

Author: Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Google+ and Twitter.

10 thoughts on “WP Super Cache Developer Documentation”

  1. Good! This is exactly what I needed.

    Now Autoptimize will interact better with WP Super Cache 🙂

    By the way, when will wp_cache_clear_cache() be available?

  2. Just wanted to thank you for your advice and the documentation. It’s great and will be really helpful in the future. My cookie-plugin, btw, works fine now 🙂 Thanks again!

  3. Feedback requested, feedback provided. 🙂

    1. “The plugin folder normally lives in wp-super-cache/plugins/ but by modifying the $wp_cache_plugins_dir variable in the config file you can put it anywhere. That’s a good idea if you develop your own supercache plugins …” That’s fine and dandy – until another SC plugin comes in and sets $wp_cache_plugins_dir for itself.

    2. Please elaborate on the four filters wp_cache_key,
    wp_cache_served_cache_file, wp_cache_get_cookies_values and do_createsupercache, such as possible secondary usages. Three common examples:

    a. running my own PHP on before serving half-on requests without editing wp-cache-phase1.php myself.
    b. force serving a fresh page if the http referer is a search engine result page.
    c. force expiring the cache for a page because of a querystring parameter.

    I call them ‘secondary usage’ because filters aren’t supposed to have side effects. Go figure.

    Sorry to bust your chops, Donncha, ye know those two sample plugins? Both absolutely aint got no inline documentation — not even one line of comment! Aint much help if your doc tells a padawan to use ’em as a reference.

    Thanks for posting this.

    1. Thanks William!

      $wp_cache_plugins_dir is set in your config file which isn’t updated when you upgrade the plugin so no need to worry about that.

      I’ll see about adding more examples, and comments to the plugins. Glad you found the docs useful.

      1. After reading through the docs I was struck a few times by ambiguity caused by your use of ‘config file’ and ‘configuration file’. I think William’s confusion is because its not clear if you mean wp-config.php or wp-cache-config.php, which is an important difference (unless it could be either, in which case that’s relevant too). If you changed uses of ‘config file’ to be the actual filename it would probably clear up several sections.

      2. Also, it would be great if there was a link to the documentation article from the main WP Super Cache page and from the readme.txt description, I tried to find it again and couldn’t except for this post.


Leave a Reply