Title: Exclude page programmatically in PHP
Last modified: February 5, 2020

---

# Exclude page programmatically in PHP

 *  [Aleksandar](https://wordpress.org/support/users/siemens82/)
 * (@siemens82)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/exclude-page-programmatically-in-php/)
 * Hi,
 * Thanks for this great plugin 🙂
 * I read through the support questions, but I’m still not clear how to exclude 
   the page in PHP code without having to go to settings and add this url to the
   list of excluded urls.
 * For example: I may create the pages dynamically and I may want to keep them out
   of the cache.
 * Another example: W3 total cache, and other cache plugins, support defining the
   PHP constant DONOTCACHEPAGE. When this is defined, w3 total cache skip caching
   the page.
 * Is there a way to use this plugin and exclude pages programmatically?
 * Thanks

Viewing 1 replies (of 1 total)

 *  [codebrewery](https://wordpress.org/support/users/codebrewery/)
 * (@codebrewery)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-page-programmatically-in-php/#post-12434431)
 * Hi,
 * I am trying to do the same thing that Aleksandar (@siemens82) is asking here.
   In addition to what Aleksandar is asking, do you have any hooks which can allow
   me to exclude pages programmatically? The main reason I am asking is that the
   caching breaks the WordPress API Custom Endpoint (by caching the response).
 * Jez

Viewing 1 replies (of 1 total)

The topic ‘Exclude page programmatically in PHP’ is closed to new replies.

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

 * 1 reply
 * 2 participants
 * Last reply from: [codebrewery](https://wordpress.org/support/users/codebrewery/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/exclude-page-programmatically-in-php/#post-12434431)
 * Status: not resolved