Support Forum
Support › MB Custom Table › How is data actually stored?Resolved
Hey there
I use custom tables and love it, but I’m wondering how it’s actually stored in the db.
What I mean is, obviously every entry is stored in its custom table, but is it also “registered” or stored in any wp table like postmeta?
I’d like to have a custom frontend dashboard as I’m not a huge fan of the limitations of the MB version, so I’d like to store my own but I have a feeling if I just dump the data into a table via sql, wordpress won’t actually know it exists.
Is there a guide on building your own frontend forms? Thanks!
Hi Amy,
What I mean is, obviously every entry is stored in its custom table, but is it also “registered” or stored in any wp table like postmeta?
The field value is only saved to the custom table instead of the table postmeta.
Is there a guide on building your own frontend forms?
There is no guide to create a custom frontend form, you will need to create a lot of custom code to process the data after submitting a form. And MB Frontend Form also supports saving the field value to the custom table, you can use two extensions to achieve the goal.
And if you want to query posts by custom fields in the custom table, you need to make an extra query to get the post IDs first. Please read more on the documentation https://docs.metabox.io/extensions/mb-custom-table/#query-posts-with-wp_query
First question -
So to clarify, if I have a custom table named: wp_locations and did an INSERT from the frontend, wordpress would recognize it and I can see it on the CPT screen for Locations, delete it, clone it, integrate it with things like admincolumnspro etc?
Second question -
Regarding the front end form, I tried using it, but I’d like a little more customization when it comes to it. Perhaps I can write up a few things I actually do need and post it to the forum to see if there are hooks available?
Right now the previous dev just hardcoded the stuff right into the plugin code which obviously gets erased on update. So I need to do things like flag fields for review (so admin can approve changes) and other custom features.
I’m not looking for custom work done, but if I told you the things needed, could you point me in the right direction with hooks and if it can be done at all (without editing core files)?
Thank you!
Hi,
1. I don't know exactly what your case is, but if you use the custom table to save custom field value, you need to use the supported functions of Meta Box to manipulate data easily. Or you have to use the $wpdb class to create the SQL query to get/update the field value.
And the custom table might not work with a third-party plugin like AdminColumns Pro. You can use our plugin MB Admin Columns to display the custom field in the table list.
2. You can use the shortcode attribute post_type
of the frontend form to set the post type of the submitted posts and approve the post later.
If you want to add something to the form or add some function before/after processing the post, please follow this documentation to know the supported hooks https://docs.metabox.io/extensions/mb-frontend-submission/#hooks-1
Okay, I did some testing with ACF/Hookturn Custom Tables and MB and this is what I found (please tell me if correct)
When a new custom entry is created, here is how it's added:
ACF/Hookturn - wp_posts, wp_customtable, wp_postmeta
MB - wp_posts, wp_customtable
Which is great! That secures MB is far and away better than ACF with Hookturn's custom field add-on. They literally duplicate the data for every entry while Metabox doesn't. So, compliments there!
Based on that, if I did create the custom frontend, I would indeed have to talk to wp_posts a little - at the very least for the 'post_updated' field. But it also does look like there are enough hooks for mb-frontend to accomplish the things I need. Being able to add classes to the table allow me to design it however I want.
I am going through an audit of the site right now to see exactly what needs to be done, but I think using mb-frontend may be a good solution. Regardless, I'll be sticking with MB for the rebuild so I'll be bugging you for more support in the future 🙂
Great.
Let me know if you have any questions.