It's possible to save custom fields only to custom table bypassing wp_posts?

Support MB Custom Table It's possible to save custom fields only to custom table bypassing wp_posts?Resolved

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #44907
    AishwaryaAishwarya
    Participant

    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.

    #44908
    AishwaryaAishwarya
    Participant

    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.

    #44912
    AishwaryaAishwarya
    Participant

    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.

    #44914
    PeterPeter
    Moderator

    Hello,

    Currently, the custom model doesn't work with frontend submission form. You can create the model entries in the admin area.

    #44919
    AishwaryaAishwarya
    Participant

    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!

    #44931
    PeterPeter
    Moderator

    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/

    #44990
    AishwaryaAishwarya
    Participant

    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 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.