Custom Import with taxonomies

It shouldn’t be hard to add handling for custom post types or taxonomies within a custom importer for WordPress. You’ll just need to make sure that your custom post types and taxonomies are registered before the importer runs. Once registered, you can use wp_insert_post() and wp_set_object_terms() on these custom types. This will likely end up being a much better solution than trying to write custom SQL as it fills in a lot of the extra fields that aren’t always obvious, like term object counts, etc.

Whenever I’m working on a script to import data from another system, I’ve always created nuke functions, for the reason you mentioned, and just because importing data is always a bunch of trial and error. The function usually just consists of a single loop to call wp_delete_post() for each post. Depending on the import, I may also add another one to call wp_delete_term() on each term in the database.

$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type in ('post', 'attachment', [...other post types])");
foreach($post_ids as $post_id) {
    wp_delete_post($post_id, true);
}