Title: API/Feature : programmatically define page cache rules
Last modified: August 10, 2022

---

# API/Feature : programmatically define page cache rules

 *  Resolved [eddr](https://wordpress.org/support/users/eddr/)
 * (@eddr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/api-feature-programmatically-define-page-cache-rules/)
 * Hi
 * – My question is how to add rules/logic?
    – Specifically, I needed page cache
   to be saved according to a *combination* of cookie groups. For example: unique
   cache for these: cookie1=3,cookie2=dog cookie1=3,cookie2=cat
 * But it isn’t the way W3TC works, it seems
 * Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/api-feature-programmatically-define-page-cache-rules/#post-15904486)
 * Hello [@eddr](https://wordpress.org/support/users/eddr/)
 * Thank you for reaching out
    You can use Cookie groups for this in Performance
   >Cookie Groups. With this, you can create a group of Cookies by specifying names
   in the Cookies field. Assign a set of Cookies to ensure that a unique cache is
   created for each Cookie group. Drag and drop groups into order (if needed) to
   determine their priority (top -> down) You should use the correct groups and 
   each group should specify {key}={value} So you should replace {key} with the 
   actual cookie name. And don’t forget to enable all the checkboxes (enable and
   cache) There should be a group for each key-value combination.
 * I hope this helps!
 * Thanks!
 *  Thread Starter [eddr](https://wordpress.org/support/users/eddr/)
 * (@eddr)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/api-feature-programmatically-define-page-cache-rules/#post-15916542)
 * Hi and thanks for the detailed response
 * However, that’s not what I meant.
    I already use the cookie group cache and it
   works, however, not as I descrtibed.
 * If you have two cookie groups: ‘a’ and ‘b’. you won’t have a unique page cached
   for each combination of these two, only for the first cookie group fetched
    Do
   you see what I mean?
 *  Thread Starter [eddr](https://wordpress.org/support/users/eddr/)
 * (@eddr)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/api-feature-programmatically-define-page-cache-rules/#post-15966177)
 * any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘API/Feature : programmatically define page cache rules’ is closed to 
new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [cookie](https://wordpress.org/support/topic-tag/cookie/)
 * [custom rules](https://wordpress.org/support/topic-tag/custom-rules/)

 * 3 replies
 * 2 participants
 * Last reply from: [eddr](https://wordpress.org/support/users/eddr/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/api-feature-programmatically-define-page-cache-rules/#post-15966177)
 * Status: resolved