Support › Meta Box Group › Default value for field in clonable groupResolved
I want current date in custom field in clonable group.
'name' => __('INSERT',TEXTDOMAIN),
'id' => $prefix . 'product_insert',
'type' => 'date',
'size' => 20,
'readonly' => true,
'std' => current_datetime()->format('Y-m-d-H-i')
Current date is only for the first group in clonable field when i create new post. If I add (click) to another group of fields, then this field is empty.
'clone_default' => true,
it works fine - but i don't want another set of fields to have default values (even if i set std to have empty values within this fields).
So, how can i do this?
You should use the setting clone_default for the subfield, not the group itself, to set the default value for a subfield in a cloneable group. Please read more on this documentation https://docs.metabox.io/extensions/meta-box-group/#clone-default-values
thank you - it helped me.