Automatically Give All Custom Post Types a Pre-Set Category [duplicate]

You can force default terms for a post by using the save_post hook. Here’s an example from the Developer resources originallly by the user Aurovrata Venet.

add_action( 'save_post', 'set_post_default_category', 10,3 );

function set_post_default_category( $post_id, $post, $update ) {
    // Only want to set if this is a new post!
    if ( $update ){
        return;
    }

    // Only set for post_type = post!
    if ( 'post' !== $post->post_type ) {
        return;
    }

    // Get the default term using the slug, its more portable!
    $term = get_term_by( 'slug', 'my-custom-term', 'category' );

    wp_set_post_terms( $post_id, $term->term_id, 'category', true );
}

For checking post types you can also use in_array() as you have multiple post types.

! in_array( $post->post_type, array( 'my_post_type_a', 'my_post_type_b', 'my_post_type_n' ) )

Another option is to use the post type specific save_post_{$post->post_type} hook and attach the same callback function to each of your post types save actions.