# Never Cache Certain URLs in WP Rocket

> Adds URL patterns that WP Rocket must never cache, such as account, quote or booking pages with personal content, without touching the plugin's settings screen.

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

## Code

```php
$wpide_patterns = array( '/my-account/(.*)', '/quote/(.*)', '/booking/(.*)' ); // Paths never cached.

add_filter( 'rocket_cache_reject_uri', function ( $uris ) use ( $wpide_patterns ) {
    return array_values( array_unique( array_merge( (array) $uris, $wpide_patterns ) ) );
} );
```

## Notes

Patterns are regular expressions matched against the path, e.g. /my-account/(.*). Save WP Rocket's settings once after activating so its config file is regenerated.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Never Cache Certain URLs 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/
