[Resolved] How to import posts with post relationships?
This thread is resolved. Here is a description of the problem and solution.
Problem:
With the changes in Types 3 the post relationship is no longer stored as post meta but in custom tables. How to import posts and maintain the relationships?
Solution:
There is a new solution to set up relationships when importing posts, described in the documentation.
This has actually seen a significant improvement with Types 3.0.
Before importing related posts was problematic because if you wanted to set the _wpcf_belongs_parent-slug_id field on a child post you needed to know the parent post ID and if you were importing a whole series of both parent and child posts at the same time the parent posts had not already been created and so their ID was unknown. That required one of various workarounds to be used when importing.
Now we have added a two-part migration tool for related posts which includes a batch job that makes all the connections automatically for you in a single import.
Just knowing that it can still be done is a huge comfort. It doesn't look like I'll have a problem figuring this out.
Thanks for the info!
PS: I'd still be interested to know if relationships could be set using custom form fields (GravityForms), when a user submits a listing. That may be another ball of wax, completely.
Relationships are no longer stored as post meta but in custom database tables instead.
The only way to set and retrieve relationship info is via the API, so you would need to use a hook when a Gravity Form was submitted and then use the tooset_connect_posts function to set the relationship.
Internally there is a switch that operates across the whole of Toolset as to whether the migration wizard has been run or not.
You can upgrade your existing sites and not run the migration wizard and everything will continue to work as before.
Then there is a compatibility layer so that if you *do* run the migration wizard your existing relationships should continue to work as before, although if you were to edit a form and auto-generate the markup the format of the relationship fields would change, for example.
My advice is to update, but only run the migration wizard if you are actively developing the site and want to take advantage of some of the new relationship features.