W3TC does not have a purge policy for custom post types.
My Problem:
I have a Custom post type 'vacancy'.
When the user adds a new vacancy I want the cache to be cleared for vacancy-archives and the home page. I can also live with a compleet cache flush.
AFAICS W3TC has no hooks for this.
The function below is ot working. How should I approach this?
add_action( 'edit_post', 'w3_flush_cpt', 10, 1 );
add_action( 'delete_post', 'w3_flush_cpt', 10, 1 );
function w3_flush_cpt( $post_id ) {
if ( 'vacancy' != get_post_type( $post_id ) )
return;
$w3_cacheflush = w3_instance('W3_CacheFlush');
$w3_cacheflush->pgcache_flush_post($post_id);
}