How do I generate separate cache files based on a cookie key?

You can use the `wpo_cache_cookies` filter to generate separate cache files. For example, you may want to generate separate cache files for different currencies. You can modify and use the following code snippet to do so:

<?php
add_filter('wpo_cache_cookies', 'myprefix_add_cache_cookies', 20, 2);

function myprefix_add_cache_cookies($cookies) {
if (// Check if some feature exists that needs separate cache) {
$cookie[] = 'cache_key_that_needs_separate_cache';
}
return $cookies;
}

How do I know what cache file is being used for displaying a page?

If you want to check what cache file is being used for displaying a page, then you should edit your wp-config.php file, change the WP_DEBUG setting and the WPO_CACHE_FILENAME_DEBUG to true

define(‘WP_DEBUG’, true);
define(‘WPO_CACHE_FILENAME_DEBUG’, true);

Then, purge the cache, reload the page and view the HTML source. Scroll down to the bottom, and you should see a line added by the cache:

<!-- Cached by WP-Optimize (gzip) - https://getwpo.com - Last modified: Wed, 01 Dec 2021 10:47:38 GMT --><!-- WP Optimize page cache debug information -->
<!-- 
Extension: .html
Filename: index.html
 --->

User specific cache

User specific cache is specifically built for your membership site, or any type of site where pages contain user specific content.

Enabling “User specific cache” will create a cache version for each logged-in user, resulting in great performance for your website members.

Note that if you have many users, this could result in a large amount of files.

The website will also be cached for non logged-in users.

Note that the cache preloader will only preload the cache for non logged-in users.

NB: User specific cache is a premium feature

How to resolve an error in advanced-cache.php

If you activate 2 caching plugins (or at least the functionality) at the same time, this might cause a fatal error and break your site.

Follow these instructions to recover your site:

  • Connect to your server via FTP (or an other way if you prefer).
  • Browse to the root of the WordPress installation, where you should have a file named wp-config.php.
  • Download this file and open it in a text editor, such as notepad (Windows) or textedit (Mac).
  • Locate the line define('WP_CACHE', true);, delete it, save the file and upload it back via FTP.
  • Then still via FTP, enter the folder wp-content and delete the file advanced-cache.php
  • You should now be able to reconnect to your administration.
  • Go to one or all of your caching plugins settings, and only keep 1 activated.

If the error comes back before you had a chance to do this:

  • Try the first part again, and before going to the admin, do the following:
  • Using FTP, browse to the folder wp-content/plugins, and rename the folders of all caching plugins (for example by adding a -).
  • Then go to Plugins in your administration, and make sure the cache plugins are deactivated.
  • Using FTP, browse to the folder wp-content/plugins, and rename the folders of all caching plugins back to their original names.
  • You can now reactivate the caching plugin of your choice.