• How would it be the best solution to avoid caching if a cookie is present?

    I’m running an archive of documents which can be downloaded by registered users and serving caching pages to non-authenticated visitors. Once you login (not as an WP author but as a ‘subscriber’ via an special plugin), there is an extra cookie on your browser. Therefore, you have to receive dynamic pages (not cached at all).

    So far I’ve solved this changing the line 24 of wp-cache-phase1.php:

    - if (!$cache_enabled || $_SERVER["REQUEST_METHOD"] == 'POST')
    + if (!$cache_enabled || $_SERVER["REQUEST_METHOD"] == 'POST' || $_COOKIE['mycookie'])

    But I am wondering if this can be also done by a wp-super-cache plugin… Any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes, you can use a the “wp_cache_get_cookies_values” cache_action to modify the cookie. Look at plugins/searchengine.php as an example of how to do it.

    Hello Donncha,

    Could you describe it with details?
    On my site I have two different views of posts (depending on a cookie) and would like to have cached both versions of page.

    I thought about creating separate htaccess rules set for these views, but I would need to modify wp-super-cache somehow to generate two types of cache files.. and additionaly I would like to have it future-versions-proof..

    You can’t cache both pages, at least with the static cache. If you change the plugin to “half on” it’ll work fine though.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP Super Cache] Avoid caching if certain cookie is present’ is closed to new replies.