MB Custom Table Clone Fields Errors
Support › MB Custom Table › MB Custom Table Clone Fields ErrorsResolved
- This topic has 3 replies, 2 voices, and was last updated 4 years, 1 month ago by
Long Nguyen.
-
AuthorPosts
-
March 8, 2021 at 5:32 PM #24773
Nicholas Witty
ParticipantHello.
We are trying to implement the MB custom table plugin on custom post type with grouped clone fields but the plugin doesn't seems to be work. Can you please help us with this.
Array ( [title] => floor_plans [type] => group [clone] => 1 [sort_clone] => [tab] => floor_plans [storage_type] => custom_table [table] => db_prefix_custom_table_name [fields] => Array ( [0] => Array ( [name] => field 1 [placeholder] => fill the field [id] => plan_title [type] => text [columns] => 12 ) [1] => Array ( [name] => field 2 [placeholder] => fill the field [id] => plan_title [type] => text [columns] => 12 ) [2] => Array ( [name] => field 3 [placeholder] => fill the field [id] => plan_title [type] => text [columns] => 12 )
March 8, 2021 at 6:59 PM #24775Long Nguyen
ModeratorHi,
Two settings
storage_type
andtable
have to be added under the meta box settings, not the field settings.And the group is a field type, it has to be added under the field settings.
For example:
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $meta_boxes[] = array( 'title' => 'Meta Box Title', 'post_types' => 'CPT', 'storage_type' => 'custom_table', // Important 'table' => 'my_custom_table', // Your custom table name 'fields' => array( array( 'name' => 'Group', // Optional 'id' => 'group_id', 'type' => 'group', // List of sub-fields 'fields' => array( array( 'name' => 'Text', 'id' => 'text', 'type' => 'text', ), // Other sub-fields here ), ), ), ); return $meta_boxes; }
Get more details on these documents
https://docs.metabox.io/extensions/mb-custom-table/#using-custom-tables
https://docs.metabox.io/extensions/meta-box-group/March 8, 2021 at 8:58 PM #24776Nicholas Witty
ParticipantThanks for your response. Does this solution works for clone grouped fields also. we would like to have multiple rows against single custom post type. Is that also possible?
March 9, 2021 at 12:07 PM #24791Long Nguyen
ModeratorHi,
Yes, it works for the cloneable group field. All sub-fields and cloneable groups will be stored in one cell of the row. Each row will store field value for one post ID.
-
AuthorPosts
- You must be logged in to reply to this topic.