Created
May 27, 2025 18:39
-
-
Save ludiofs/5b8dd206717ef8b4f0f7f03da25b71f6 to your computer and use it in GitHub Desktop.
Disable batcache for specific post type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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