Title: Cache based on query params
Last modified: September 11, 2023

---

# Cache based on query params

 *  Resolved [mcsr](https://wordpress.org/support/users/mcsr/)
 * (@mcsr)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/cache-based-on-query-params/)
 * Hi there,
 * I’ve created a custom REST-API route on my WordPress site, which looks like this:`
   https://mydomain.com/wp-json/namespace/v1/custom-route?query=test`
   The custom
   route is mostly based on query parameters.
 * It seems to me that WP REST Cache is not caching based on the `query` is there
   a way to include this and other query parameters into the cache key? There should
   be an individual item in the cache for each query parameter, that is being passed
   to the route.
 * Thanks in advance!

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

 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/cache-based-on-query-params/#post-17041676)
 * Hi [@mcsr](https://wordpress.org/support/users/mcsr/)
 * Thank you for using our plugin!
   It is not because of the `query` parameter, custom
   endpoints aren’t cached by default. You can tell our plugin to cache your endpoint
   as described in [our FAQ](https://wordpress.org/plugins/wp-rest-cache/#can%20i%20register%20my%20own%20endpoint%20for%20caching%3F)
 *  Thread Starter [mcsr](https://wordpress.org/support/users/mcsr/)
 * (@mcsr)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/cache-based-on-query-params/#post-17041832)
 * Thanks [@rockfire](https://wordpress.org/support/users/rockfire/) ! Now it’s 
   working.
 * Really like your plugin because it works in nearly any environment without significant
   changes to the configuration 🙂

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

The topic ‘Cache based on query params’ is closed to new replies.

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

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [key](https://wordpress.org/support/topic-tag/key/)
 * [params](https://wordpress.org/support/topic-tag/params/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * 2 replies
 * 2 participants
 * Last reply from: [mcsr](https://wordpress.org/support/users/mcsr/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/cache-based-on-query-params/#post-17041832)
 * Status: resolved