I have exported a CSV of a many-many post relationship ('journal-issue-people' between parent 'journal-issue' and child 'people') - which I have accomplished using a custom script in WP All Export. However, for one of the relationships I need to add data from a relationship custom field (wpcf-author-order - format:number) that was created to record the order of the child posts. WP All Export are unable to do this or assist with it.
Can you explain the database structure of where those custom fields are recorded? I have two tables in my database wp_toolset_associations and wp_toolset_associations_old - I think from when Toolset changed the way it handled relationships a couple of years ago?
In wp_toolset_associations_old the parent and child post IDs are present and an intermediary_id - which I seems to link to wp_postmeta to store additional information.
However, the new wp_toolset_associations is totally different (sequential IDs) and I can't make out what is going on to write a custom script to extract the custom field information. Can you explain how the relationship custom field information is stored?
Hi,
Welcome to Toolset support. It is hard to give all the details on how the relationships work from Toolset Types 3.4 onward. I will try to give as much information I have:
The actual connections live in wp_toolset_associations.
The IDs in parent_id, child_id (and intermediary_id when present) do not point directly to wp_posts.ID. They point to groups in wp_toolset_connected_elements, which then map to the real post IDs via the element_id column.
More information: https://toolset.com/forums/topic/post-relationships-8/
When a relationship has fields (like your wpcf-author-order), Toolset creates an intermediary post behind the scenes and stores those field values in wp_postmeta for that intermediary post. The association itself still sits in the dedicated table; the intermediary post only holds the extra fields.
More information: https://toolset.com/2017/04/first-preview-of-many-to-many-relationship-in-toolset/
(Older sites used wp_toolset_associations_old and/or stored links in postmeta. New Types uses the dedicated tables; that change is documented here. )
Please consider that the relationship export/import feature is deprecated and we do not support that anymore.
Thanks.