First item in Group field not being saved
Support › Meta Box AIO › First item in Group field not being saved
- This topic has 3 replies, 2 voices, and was last updated 23 hours, 43 minutes ago by
Peter.
-
AuthorPosts
-
April 14, 2026 at 2:29 AM #49909
Generator
ParticipantI have a group field and the first item isn't being saved. I have used group several times and it's the first time I've seen this issue. This is my field definition:
$meta_boxes[] = array( 'title' => __('Sidebar Content', 'slsh-admin'), 'context' => 'normal', 'priority' => 'high', 'post_types' => array('job-opportunity'), 'fields' => array( array( 'id' => 'position-details', 'type' => 'group', 'add_button' => 'Add a Detail +', 'clone' => true, 'sort_clone' => true, 'fields' => array( array( 'id' => 'label', 'name' => __('Label', 'slsh-admin'), 'desc' => __('e.g. Location, Salary, Start Date', 'slsh-admin'), 'type' => 'text' ), array( 'id' => 'value', 'name' => __('Value', 'slsh-admin'), 'desc' => __('e.g. Hamilton, ON; 50,000-60,000 a year; Jan 1, 2000', 'slsh-admin'), 'type' => 'text' ) ) ) ) );And my data is being saved like this:
a:2:{i:0;a:2:{s:5:"label";s:10:"Start Date";s:5:"value";s:11:"Jan 1, 2027";}i:1;a:2:{s:5:"label";s:8:"Schedule";s:5:"value";s:15:"Mon-Fri 9am-5pm";}}
There should be one more item in my field value.
April 14, 2026 at 10:26 PM #49912Peter
ModeratorHello,
I don't see any issue when using your code to create a new field group and save the clone subfields to the database. Can you please share a screen record of the issue on your site? Does it happen with new posts or existing posts?
April 15, 2026 at 12:04 AM #49914Generator
ParticipantBelow is how it looks in my editor. The values of first field group that I create are not saved. This happens on every post, both when creating and updating. After the post is saved, the first field group always appears empty like in the screenshot below.
A few other things I noticed:
I cannot remove the empty field group. If I delete it and save the post, it reappears after I refresh the editor.
I can reorder the field groups, but after refreshing the editor, the empty one will reappear at the top.
The empty field group has the .rwmb-clone-template class. The markup looks like this:<div class="rwmb-input ui-sortable" data-clone-empty-start="0"> <div class="rwmb-clone rwmb-group-clone rwmb-sort-clone rwmb-clone-template"> <!-- empty field group --> </div> <div class="rwmb-clone rwmb-group-clone rwmb-sort-clone"> <!-- next field group --> </div> </div>April 15, 2026 at 6:01 PM #49915Peter
ModeratorHello,
Please share your site admin account by submitting this contact form https://metabox.io/contact/
I will take a look.Thank you.
-
AuthorPosts
- You must be logged in to reply to this topic.