Support › MB Custom Table › Moved to custom table, data is in DB, but not on edit post
Posted in Facebook Group: https://www.facebook.com/groups/metaboxusers/posts/1254445061839802
Hi, I recently changed custom fields to be stored in a custom table by following this guide https://docs.metabox.io/tutor.../move-data-to-custom-tables/. The data is pulled correctly when using MB Views; however, if I go to edit the CPT with the custom fields, it's not pulling all the field data. It's quite bazaar as on the edit screen, two fields are populated but the rest of the fields are empty. I tried changing the field types from URL to Text and then in the DB I have it stored as varchar(255), which is the way the one field that is populating data is stored, but it still won't show up on the edit screen. I've disabled object cache (Redis) and that didn't do anything and I made sure that the field that is populating isn't in the wp_postmeta table and I manually updated the field in the database to make sure it was populating from the table, and it updated when I refreshed the edit screen. There aren't any NULL values either in the row. So I'm completely dumbfounded. Can anyone help?
The benefits are that it shrunk my wp_postmeta table down from ~130mb to 30mb and, well, it made sense from a database structural view as the data (in this case, the "data" is mostly information I want to store about a CPT that's automatically imported via WP Webhooks and to have that data available for debugging purposes. Only two of the 15 custom fields shown on the front end, in this case "Article URL" and "Article Querystring". What's interesting is that, for example, Article URL was a "URL" data type in Meta Box and Article Querystring was a regular text field. Both are stored in the database as varchar(255) but Article URL is blank on the edit page whereas Article Querystring is populated from the custom table. I tried changing Article URL in Meta Box to be a Text field like Article Querystring, but it still won't populate that textbox on the edit page. If I look at the HTML of the Article URL text box on the edit page, I can see that the input is type="text" instead of "url" and by all accounts looks identical to Article Querystring. This is just one specific example, but it's the same for fields that were Number fields. Some Text fields aren't populating as well, and I can't think of any reason why they wouldn't.
Please access your database, set the column data type to
TEXT and check this issue again. If it does not help, please share your site credentials via this contact form https://metabox.io/contact/
I will inform our development team to check the issue on your site.