[Resolved] How do I create 2 child records from a new parent record using the API?
This support ticket is created 6 years, 11 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi,
I am collecting details about an order (Custom Toolset Type) and collecting 2 peoples names on that form. What I'd like to do on successful save is: a) Create 2 new People (Custom Type) posts and b) join them to the order by creating a child Order Person post (m-2-m join post type).
I'm sure this is possible however can't seem to find an example, please could you help me out?
Many thanks in advance,
Si
Many thanks Noman. I can create the post however I cannot seem to set my custom type fields. I tried with the same name as used by cred_field as well as prefixing it with 'wpcf-' but it doesn't seem to work. Any ideas please?
Si
Types is using a custom field "_wpcf_belongs_{parent-post-type-slug}_id" to store parent post ID, for example:
- parent post type = edition
-- child post type = article
In each child (article) post, there is a custom field "_wpcf_belongs_edition_id", the field value is parent (edition) post ID.
Further, as this is a custom requirement it would need some custom coding to make it work. We have some recommended list of service providers here if you would like to take a look: https://toolset.com/consultant/