By default, FlyingPress automatically determines whether a page should be cached based on factors like user status, query parameters, cookies, etc. However, if you need to apply custom logic to control caching behavior, you can use the flying_press_is_cacheable filter.
Where to add this code
Add the filter in:
Your theme’s
functions.phpfileA custom plugin
A plugin like Code Snippets
Example: Conditionally skip caching
add_filter('flying_press_is_cacheable', function ($is_cacheable) {
// Example: Don't cache if a specific query parameter exists
if (isset($_GET['nocache'])) {
return false;
}
// Example: Don't cache a specific path
if (strpos($_SERVER['REQUEST_URI'], '/no-cache/') === 0) {
return false;
}
return $is_cacheable;
});
Notes
Return
falseto prevent caching for the current requestReturn
trueonly if you are certain the request is cacheableAlways return the original
$is_cacheableif your condition doesn't apply
