Hello,
For example, I have a taxonomy field and a taxonomy_advanced subfield in a group field, like this
$meta_boxes[] = [
...
'fields' => [
[
'name' => __( 'Taxonomy', 'your-text-domain' ),
'id' => 'taxonomy_field',
'type' => 'taxonomy',
'taxonomy' => ['drink-recipe'],
'field_type' => 'select_advanced',
],
[
'name' => __( 'Group', 'your-text-domain' ),
'id' => 'group_field',
'type' => 'group',
'fields' => [
[
'name' => __( 'Taxonomy Advanced', 'your-text-domain' ),
'id' => 'taxonomy_advanced_field',
'type' => 'taxonomy_advanced',
'taxonomy' => ['drink-recipe'],
'field_type' => 'select_advanced',
],
],
],
],
];
Then the code to set the post term from the taxonomy_advanced field would be:
add_action( 'rwmb_group_field_after_save_field', function ( $null, $field, $new, $old, $object_id ) {
$term_id = (int)$new['taxonomy_advanced_field'];
wp_set_object_terms( $object_id, $term_id, 'drink-recipe' );
}, 10, 5 );
This is the example code, if it does not work on your site, please contact us with the link below and request a customization service, our development team will help you to check the issue.
https://metabox.io/contact/