Skip to main content

Customize Ignored Query Parameters

Updated over 2 weeks ago

FlyingPress automatically ignores common query parameters like utm_source, gclid, fbclid, etc., while generating the cache key. These parameters usually come from ad platforms, email campaigns, or analytics tools and don’t affect the actual page content. Ignoring them prevents duplicate cache entries and improves cache efficiency.

By default, FlyingPress strips these parameters from the URL before caching. However, if you need more control, you can customize this behavior using a filter.

Use Case

You may want to:

  • Ignore additional query parameters specific to your site

  • Include a query parameter in the cache key that’s ignored by default

Where to add this code

Add the code in one of the following:

  • Your theme’s functions.php file

  • A custom plugin

  • A plugin like Code Snippets

Add parameters to ignore

add_filter('flying_press_ignore_queries', function($ignore_queries) {
$ignore_queries[] = 'my_custom_param';
$ignore_queries[] = 'tracking_code';
return $ignore_queries;
});

Remove parameters from the ignored list

add_filter('flying_press_ignore_queries', function($ignore_queries) {
return array_diff($ignore_queries, ['utm_term', 'ref']);
});

⚠️ Tip: Be careful when removing query parameters from the list. If the parameter doesn’t change page content, it’s better to keep it ignored to improve cache hit ratio.

Did this answer your question?