Hi,
This is a hard question :). I think the filter allows you to change the value of whole group, as the group is the actual field you're filtering. So, $old
and $new
are arrays (of sub-field values). I guess you're using a cloneable group? If so, then $old
and $new
are arrays (of clones), each clone is an array of sub-fields.
Let's try with the code below:
add_filter('rwmb_GROUP_ID_value', 'prefix_change_value',10,3);
function prefix_change_value ( $new, $field, $old )
{
$text_field_id = 'SUB_FIELD_ID';
foreach ( $new as $k => $clone )
{
$new[$k][$text_field_id] = uniqid();
}
return $new;
}