Support Forum
I got it. I've looked at the CPT-Onomies plugin and found a solution for that. Please paste the following code into your theme/plugin:
add_action( 'save_post', function( $post_id ) {
prefix_save_custom_tax( $post_id, 'location', 'taxonomy_2' );
}, 20 );
function prefix_save_custom_tax( $post_id, $taxonomy, $field_id ) {
global $cpt_onomies_manager, $cpt_onomy;
// Make sure its a valid CPT-onomy.
if ( ! $cpt_onomies_manager->is_registered_cpt_onomy( $taxonomy ) ) {
return;
}
$new = isset( $_POST[ $field_id ] ) ? $_POST[ $field_id ] : array();
$new = array_unique( array_map( 'intval', (array) $new ) );
$new = empty( $new ) ? null : $new;
// Set the terms.
$cpt_onomy->wp_set_object_terms( $post_id, $new, $taxonomy );
}
Note that I separated the function that save terms, so you can call it multiple times for different taxonomy field.
I hope that works for you. Please let me know after you tested it.