Customize query string caching

Query strings are not cached by default but we do make some automatic exceptions which are detailed here: 
https://docs.wp-rocket.me/article/971-caching-query-strings

It's possible to further customize how query strings on your site are handled by using the following helper plugin.

📥   Download (.zip):  WP Rocket | Ignore Query Strings
Developers: You can find the code for this plugin on GitHub.

The helper will enable you to: 

1. Remove ignored parameters from the list that uses the standard cache file. 

2. Add parameters to the list that uses the standard cache file. 

To clarify - using the standard cache file means that each value of a parameter will use the same cache file - that of the base URL. 

Heads up! You should edit the helper plugin before you activate it on the website. 
And the steps below should be followed in the listed order for the changes to be properly applied.

Remove parameters from the "ignored" list

Removing parameters from the ignored list will prevent caching for that parameter. To remove parameters from the “ignored” list:

  1. Uncomment this line: https://github.com/wp-media/wp-rocket-helpers/blob/68471ee6dad88582d49bc69f7086ecd761da7ccd/cache/wp-rocket-cache-ignore-query-strings/wp-rocket-cache-ignore-query-strings.php#L30
  2. Replace utm_source with your desired parameter. 

To cache a parameter with a separate cache file for each value, follow the above steps and also add your parameters to the Cache Query Strings field on the Advanced Rules tab. 

Add parameters to the "ignored" list

If there are some query strings you want cached, but you want them to use the same cache file and NOT create a separate cache file for each value:

  1. Edit this line: https://github.com/wp-media/wp-rocket-helpers/blob/68471ee6dad88582d49bc69f7086ecd761da7ccd/cache/wp-rocket-cache-ignore-query-strings/wp-rocket-cache-ignore-query-strings.php#L29
  2. Replace new_query_string with the name of your desired parameter.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.