Support Forum
Support › MB Custom Table › It's possible to save custom fields only to custom table bypassing wp_posts?Resolved
I am creating custom fields only using PHP code.
I creating a form to get entries for income/expense as part of the project and this doesn't have any relationship with wp_posts
and wp_post_meta
.
I referred to this support threads https://support.metabox.io/topic/store-mb-settings-not-to-posts/?swcfpc=1
https://docs.metabox.io/extensions/mb-custom-table/#creating-a-custom-table
I don't want to create a post in wp_posts table for each entries as it doesn't required. It is possible to bypass storing the custom field values to wp_posts and just save to the custom table using
'storage_type' => 'custom_table', // Must be 'custom_table'
'table' => 'transactions',
Let me put it straight: I simply want to utilize the Metabox fields to display on the frontend submission using a shortcode, without being tied to any 'post_type,' and save them to a custom table.
Sorry, I missed this part in the documentation https://docs.metabox.io/extensions/mb-custom-table/#custom-models I think Custom models is the one I am looking for.
This is great and this what developers need when actually building custom big project (y)
Let me try it.
It seems like it doesn't support frontend submission. It created table successfully, form populated in the front-end, date picker not working and when submitting the form, it does saved to wp_posts instead of the custom table.
Hello,
Currently, the custom model doesn't work with frontend submission form. You can create the model entries in the admin area.
Yes, I started writing my own code for that.
It would be great if you add feature to group multiple fields like a field like
[
'id' => 'start_group',
'type' => 'start_group', //this may create flex style like <div class="flex-row">
],
[
'id' => 'relation',
'type' => 'select',
'name' => 'relation',
'options' => [
's-o' => 'S/O',
'd-o' => 'D/O',
'w-o' => 'W/O',
],
],
[
'id' => 'relation_name',
'type' => 'text',
'name' => 'Name',
],
[
'id' => 'start_group',
'type' => 'end_group',
],
This is a simple implementation so we can save a lot of vertical space and also it will be meaningful to have fields in horizontal grouping for fields like S/O - Name values.
I hope you understand!
Hello,
In the builder, you can use the Before and After settings of custom fields to create a wrapper div. Please check this screenshot https://imgur.com/a/Tk9pBXi
If you use the code, please follow the documentation https://docs.metabox.io/field-settings/
Hi,
Sorry for the delay.
If it covers both the label and input means, that's what I want. Thanks so much for the information.
Have a nice weekend 🙂