Preventing the Caching of Dynamic Functions in WP Super Cache

WP Super Cache is commonly used to speed up WordPress blogs and reduce server load. In essence, it stores static HTML copies of pages on your blog so they will load faster the next time they are accessed. It works fairly well, but with one caveat that may be frustrating at times: The pages don’t change until the cache expires (every 30-60 minutes or so) and the static page is updated. That makes it hard to do some things where you need to process information unique to each user, such as checking HTTP referrer headers and serving ads to visitors coming from search engines.

Fortunately, there is a way around it in some cases. If you have a function in your template, you can do something like this:

<!--mfunc function_name( 'parameter', 'another_parameter' ) -->
 <?php function_name( 'parameter', 'another_parameter' ) ?>
 <!--/mfunc-->

You take a function call and surround it by the “mfunc” comments, in which the first contains a duplicate of the function. This will (somehow) instruct WP Super Cache to allow the function to execute, even in the static cached version of the page.

  • http://www.alachisoft.com wesnur

    Hi Matt,

    Its true that dynamic caching is the need of the hour because state of the growth unfolds many opportunities but is also holds challenges as a result of change. I would like to suggest you and all the other readers to take a look on this article too. Benefits of using NCache Dynamic Clustering Capabilities. This article also talks about the uses of dynamic caching.