Hello seem to be a bug while creating a custom field group.
The error seem to be when assigning custom field group to 'attachment' post type AND with the parameter 'media_modal' => true.
The result is: the custom field is not saving to database and other strange error if you assign to other post types together
I think that the problem is in html rendered.
Please look at this image: https://ibb.co/k5cv6Ds
a simple php code of creating custom field group:
$meta_boxes[] = [
'id' => 'attachment_cf',
'title' => 'Campi extra',
'post_types' => 'attachment',
//'context' => 'normal',
//'style' => 'default',
//'closed' => false,
//'priority' => 'high',
//'default_hidden' => false,
//'autosave' => false,
'media_modal' => true,
'class' => '',
//Campi
'fields' => array(
//Url alternativo
[
'name' => 'Url alternativo',
'id' => 'url_alt_webp',
'type' => 'text',
//'readonly' => 'false'
],
)
];