Skip Navigation

[Resolved] Changing custom post details in database

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by NathanG920 3 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1691499

Tell us what you are trying to do?

I have a toolset custom post with a whole lot of custom fields (thousands of rows of data) that i'd like to be able to create tables/filter, however it seems all the custom posts i've made in Toolset appear to be stored in the wp_postmeta and as such they dont have the proper rows/columns and so the data doesn't come out right at all. I populated all those custom fields with WPAllImport from a CSV which already has all the correct columns and rows which i could use to create a new database table, but is there a way to link this to the Toolset custom post and its fields so that when i add new data it transfers between the new database table i create rather than the default postmeta one?

Any assistance would be greatly appreciated.

Is there any documentation that you are following?
No

Is there a similar example that we can see?
Trying to create any type of standard table with existing Toolset data

What is the link to your site?
Hosted locally

#1691781

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

Thank you for getting in touch.

From your post I gather that you want to store your Toolset Data is a separate custom table that you created?

Unfortunately this is not possible as Toolset uses the standard wordpress functions to add the data to the database, which would store the custom Posts in the WP_Posts table and the custom fields in the WP_POSTMETA table.

Any custom table that you create to store any data to the database would require a custom function to retrieve them. This means that you will need to write a query to retrieve any of your data.

If I had misinterpreted the issue please let me know and I'll be more happy to clarify.

Thanks,
Shane

#1692157

Hey Shane,

Thanks for such a quick response. That was pretty much what i was asking so thanks for explaining it to me. If that method isn't possible, would it be possible to somehow duplicate how Toolset stores the data?
So for instance, while all the custom posts and custom fields still save in WP_Posts and WP_Postmeta, would there be a way to make it so that when they receive new entries they ALSO save to another, separate table and update it's data? That way i could query the data from the new table, whilst Toolset still saves its data to the same table, just another one too.

I'm not sure if that makes total sense, but please let me know if there's something i didn't explain correctly.

Thanks,
Nathan

#1692169

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nathan,

This would be possible but using the save_post hook that wordpress provides.
https://developer.wordpress.org/reference/hooks/save_post/

However you will need need to write a custom function that would allow you to store your data to the database.

I would suggest having a read on this article in the link below.
hidden link

Thanks,
Shane

#1692171

Perfect, thanks so much!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.