Skip to content

Instantly share code, notes, and snippets.

@vanpariyar
Created April 8, 2022 09:58
Show Gist options
  • Select an option

  • Save vanpariyar/8c638744c9451f44831d65acb3128c4a to your computer and use it in GitHub Desktop.

Select an option

Save vanpariyar/8c638744c9451f44831d65acb3128c4a to your computer and use it in GitHub Desktop.
do not cache specific page pressable batcache.

Exclude page by URL

if ( $batcache ) {
   /**
    * exclude URL from cache.
    */
    $exclude_cache = array('/some-page/','/other-page/');
    if(in_array($_SERVER['REQUEST_URI'], $exclude_cache )){
        $batcache->max_age = 0;
    }
  }
}

Exclude page by Request

if ( $batcache ) {
   /**
    * exclude URL from cache.
    */
    if( isset( $_GET['FOO'] ) && ( "BAR" == $_GET['FOO'] )){
        $batcache->max_age = 0;
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment