# Cache Pages With Certain Query Strings in WP Rocket

> Tells WP Rocket to keep separate cached copies for URLs with the query parameters you list, such as a currency or filter parameter, instead of skipping the cache for them.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: wp-rocket, cache, query-strings
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/rocket-cache-query-strings/

## Code

```php
$wpide_params = array( 'currency', 'filter_color' ); // Query parameters that deserve their own cache.

add_filter( 'rocket_cache_query_strings', function ( $params ) use ( $wpide_params ) {
    return array_values( array_unique( array_merge( (array) $params, $wpide_params ) ) );
} );
```

## Notes

Only add parameters that change page content. Re-save WP Rocket's settings after activating.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Cache Pages With Certain Query Strings in WP Rocket" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
