Skip Navigation

[Resolved] Maintaining Post relationships when importing data

This support ticket is created 6 years, 7 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Cam Macduff 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#573469

Tell us what you are trying to do? Import a large data set using WP Import All plugin. I've two data sets. Vets and Vet Practices. Is there a way to relate these two data sets automatically on import? I want vets as children of their respective practices and not have to do it manually as there are 2550 vets.
There's a common field to both data sets already. 'Practice Name'. Can we use that?

Is there any documentation that you are following? None I can find.

Is there a similar example that we can see? hidden link

What is the link to your site? hidden link

#573524

Dear Cam,

I don't think there is a existed workaround that can achieve what you want:
relate these two data sets automatically on import.

Types plugin is using a custom field to store the parent post ID, for example: the parent post type is using slug "property"
, then in each child post, there is a custom relationship field "_wpcf_belongs_property_id", which value is parent "property" post ID.
See our document:
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
In your database, each room points to its property parhqualing the ID of the property.

When you import the data, you will need to import the parent posts first, then you can get the new parent post IDs, with them, you can manually setup the custom field "_wpcf_belongs_[PARENT]_id" field value for each child post, and finally, you can import the child posts.

#574740

Damn. That could be tricky.
Can we do anything on the back end in mysql to relate these dynamically?

#574754

I don't think there is other existed workaround, since the post IDs will be changed after you import the database. If you agree, we can take it as a feature request, our developers will evaluate it.

#574761

Yes thanks, if they can figure a way to set up or preserve related parent/child posts, it'd be a huge boon!
We often have sites where we need to import large datasets from xml or csv and there are relationships that are too many to do one by one.
If you could point to a field to match on import, that would be awesome.
Maybe partner up with WP All Import and see what you could co-ordinate?

#591138

For anyone looking, I found this on the forum, however I've not been able to get this script working for my imports.
https://toolset.com/forums/topic/automatically-linking-child-posts-during-wp-allimport-pro/

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