Disabling auto-clear-cache when saving a post of specific posttype

Hi there all!

I’m hoping, someone can help me with my custom code. I want to disable the automatic-cache-clearing when a post from a specific posttype (called „anfrage“) is created.

My code from the mu-plugin is now like:

add_filter('comet_cache_disable_auto_clear_cache_routines', 'disable_on_anfrage', 10, 0);
function disable_on_anfrage($query) {
   if ( ( !is_array( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'anfragen' ) || 
        ( is_array( $query->query_vars ) && in_array( 'anfragen', $query->query_vars ) ) ) {
        return TRUE;
   }
}

I’m afraid, I’m on the wrong way. Now it seems, that all of the auto-clear-performance is disabled. Please for help!
Thanks in advance! Diana

I haven’t tried it, but how about something based on this:

add_filter( 'comet_cache_disable_auto_clear_cache_routines', 'disable_on_anfrage', 10, 0 );

function disable_on_anfrage() {
    global $post; 
    if ( $post->post_type = 'anfrage' ) {
        return true;
    }
}

You need to add something about saving or publishing the post, though.

I’m sorry, didn’t get a notification, that there is a new answer. But I just tried your solution and it didn’t work. I guess you are right, that I have to add something about saving or updating the post. But how can I do that?

I am working with Toolset Types and Cred-Forms, this Frontend-Cred-Form creates a post of my custom post type “anfrage”. And Cred has several hooks, which I’m using in my functions.php. For example a “cred_before_save_data” in which I’m converting datepicker-dates to unix-timestamp before saving the post. And a “cred_save_data” in which I’m updating the post with a custom title.

So I could hook in here, but in the Forum of Comet Cache it’s mentioned, that the comet-cache-filter has to be placed as a mu-plugin. Hmmm … Unfortunately I’m a php-beginner. So I really don’t know how to get this to work. Any ideas?

Or is there another easier way, to NEVER cache the custom post type “anfrage”?
Or NEVER clear the cache of custom post type “anfrage”?