Skip to content

Instantly share code, notes, and snippets.

@ludiofs
Created May 27, 2025 18:39
Show Gist options
  • Save ludiofs/5b8dd206717ef8b4f0f7f03da25b71f6 to your computer and use it in GitHub Desktop.
Save ludiofs/5b8dd206717ef8b4f0f7f03da25b71f6 to your computer and use it in GitHub Desktop.
Disable batcache for specific post type
<?php
// Disable post types from batcache/object cache - working
add_filter( 'advanced_post_cache_skip_for_post_type', 'apc_exempted_cpts', 10,2);
function apc_exempted_cpts($return_me,$post_type) {
$exempted = array('project');
if ( in_array($post_type,$exempted) ) {
return true;
}
return $return_me;
}
if ( strpos($_SERVER['REQUEST_URI'], '/wp-json/') !== false ) {
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: 0");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment