-
Notifications
You must be signed in to change notification settings - Fork 566
Closed
Description
Expected Behavior:
The meta value of the repeater group to be empty
Actual Behavior:
Instead returning one entry in the array with a file_id field containing 0
get_post_meta(...) array(1)
→array(1)
'myprefix_file_id' => integer 0
Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):
- Save a post without filling these data in
- Output the data of the meta - try to compare with version 2.2.1
CMB2 Field Registration Code:
add_filter( 'cmb2_meta_boxes', function( $meta_boxes ) {
return [ 'prefix_my_repeater' => [
'title' => __( 'Fact boxes' ),
'id' => 'prefix_my_repeater',
'type' => 'group',
'object_types' => 'post',
'fields' => [
[
'id' => 'prefix_factbox_group',
'type' => 'group',
'description' => __( 'Add multiple fact boxes to the page' ),
'options' => [
'group_title' => __( 'Fact box {#}' ),
'add_button' => __( 'Add another fact box' ),
'remove_button' => __( 'Remove fact box' ),
'sortable' => true
],
'fields' => [
[
'name' => __( 'Title' ),
'id' => 'prefix_title',
'type' => 'text'
],
[
'name' => __( 'Image' ),
'id' => 'prefix_image',
'type' => 'file'
],
[
'name' => __( 'Text' ),
'id' => 'prefix_text',
'type' => 'wysiwyg',
'options' => [
'media_buttons' => false,
'teeny' => true,
'textarea_rows' => 6
]
],
[
'name' => __( 'Link' ),
'id' => 'prefix_link',
'type' => 'text_url'
],
[
'name' => __( 'Link text' ),
'id' => 'prefix_link_text',
'type' => 'text'
]
]
]
]
] ];
return $meta_boxes;
} );Metadata
Metadata
Assignees
Labels
No labels