Title: Exclude X page
Last modified: February 8, 2022

---

# Exclude X page

 *  Resolved [fraskeke](https://wordpress.org/support/users/fraskeke/)
 * (@fraskeke)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/exclude-x-page/)
 * Hello, I have tried the plugin and I have obtained very good results, so first
   of all, thank you for your work.
 * Could you explain how to disable the cache on a particular page?
 * I have read this:
 * > Can I exclude page X from being cached?
   >  Of course. If you pass a “Cache-Control:
   > no-cache” header (or max-age=0) the request will automatically be excluded 
   > from cache. Note that most WordPress plugins will already do this where necessary.
 * Where to add Cache-Control: no-cache?
 * I know the plugin has no configuration but it would be great if you could add
   a field to exclude pages by ID for example.
 * Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Konstantin Kovshenin](https://wordpress.org/support/users/kovshenin/)
 * (@kovshenin)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/exclude-x-page/#post-15343277)
 * Hey there, thanks for trying out Surge!
 * If you’re comfortable writing a small plugin, the simplest way to prevent a specific
   page ID from being cached would be:
 *     ```
       add_action( 'template_redirect', function() {
           if ( is_page( 123 ) ) {
               header( 'Cache-Control: no-cache' );
           }
       } );
       ```
   
 * The argument to is_page() could also be a slug, title or array of IDs/titles/
   slugs which is very convenient:
 * [https://developer.wordpress.org/reference/functions/is_page/](https://developer.wordpress.org/reference/functions/is_page/)
 * Hope that helps!
    -  This reply was modified 4 years, 2 months ago by [Konstantin Kovshenin](https://wordpress.org/support/users/kovshenin/).
 *  Thread Starter [fraskeke](https://wordpress.org/support/users/fraskeke/)
 * (@fraskeke)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/exclude-x-page/#post-15343429)
 * Amazing, thanks a lot 🙂
 *  Plugin Author [Konstantin Kovshenin](https://wordpress.org/support/users/kovshenin/)
 * (@kovshenin)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/exclude-x-page/#post-15343481)
 * You’re very welcome, let me know if there’s anything else I can help with!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Exclude X page’ is closed to new replies.

 * ![](https://ps.w.org/surge/assets/icon-256x256.jpg?rev=2639176)
 * [Surge](https://wordpress.org/plugins/surge/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/surge/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/surge/)
 * [Active Topics](https://wordpress.org/support/plugin/surge/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/surge/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/surge/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Konstantin Kovshenin](https://wordpress.org/support/users/kovshenin/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/exclude-x-page/#post-15343481)
 * Status: resolved