# Use LiteSpeed Private Cache on Personalised Pages

> Serves pages you choose (such as a dashboard or account page) from LiteSpeed's private per-visitor cache instead of the public one, so personal content is cached safely.

- Type: PHP
- Runs: Frontend cl
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: litespeed, cache, private
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/litespeed-private-cache-logged-in-pages/

## Code

```php
$wpide_pages = array( 'dashboard', 'my-account' ); // Page slugs or IDs.

add_action( 'template_redirect', function () use ( $wpide_pages ) {
    if ( defined( 'LSCWP_V' ) && is_page( $wpide_pages ) ) {
        do_action( 'litespeed_control_set_private', 'wpide personalised page' );
    }
} );
```

## Notes

List the page slugs or IDs in $wpide_pages.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Use LiteSpeed Private Cache on Personalised Pages" 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/
