Use wp_set_object_terms( $object_id, $terms, $taxonomy, $append );
to get this done.
You are adding everything with add_post_meta
which will not add category to your post type.
wp_set_object_terms( $post_id, sanitize_text_field($_POST['some_field'] ), 'schooltype', true );
But here I am also not sure how to assign parent-children relationship via
wp_set_object_terms
, even it’s not mentioned on WordPress codex! I think you should use:
wp_insert_term( $term, $taxonomy, $args = array() );
.
You can also check these links:
https://codex.wordpress.org/Function_Reference/wp_insert_term
How to set hierarchical terms to a post using wp_set_object_terms