How to exclude CPT Archive from cache
-
I would like to disable caching for a specific custom post type archive.
On the Plugins Settings page I can only define Posts IDs but archive pages don’t have an ID.
On you supports page I read it could be solved by defining the constant “DONOTCACHEPAGE” and setting it to true.
Unfortunately this does not work for me.
Where do I have to set this constant.
I tried this:
function heilbronn_disable_events_caching(){ global $post; // check if we are on events archive page if( is_post_type_archive( 'tribe_events' ) ){ // set do not cache constant if( ! defined( 'DONOTCACHEPAGE' ) ){ // wp_die('Set to not cache.'); define( 'DONOTCACHEPAGE', true ); } } } add_action('wp_head', 'heilbronn_disable_events_caching');
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to exclude CPT Archive from cache’ is closed to new replies.