Purge Custom Post Types
-
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); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Purge Custom Post Types’ is closed to new replies.