Skip Navigation

[Resolved] Import post relationships to new site

This support ticket is created 2 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 – 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: Africa/Casablanca (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by nickH-5 2 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#2111127

I am creating a rebuild of my site to get away from Layouts and move to blocks plus get rid of a lot of garbage left behind by previous plugins etc.

I am therefore importing CPTs to a completely new site with a new database.

I can import and export custom posts and fields and ma using WP All Export/Import Pro

I have looked at the documentation here https://toolset.com/course-lesson/import-posts-from-csv-with-relationships-using-wp-all-import/ but when I export a CPT there is no field showing the related parent (for the example in this documentation, my "presentations" CSV file has no column for "speaker" and when I export I have checked and no fields are showing up for the relationships my posts have

Not sure what I am doing wrong

#2111367

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting Toolset support.

I don't think that the WP All Import plugin has support for exporting related data. At least, I could not find anything about it on their website hidden link

However, you can export the data and the link to its related posts using the default WordPress exporter at Toolset->Export. The associations to related posts will be similar to the following XML:

<wp:meta_key><![CDATA[_toolset_associations_owner-hotel]]></wp:meta_key>
<wp:meta_value><![CDATA[<em><u>hidden link</u></em>;

Another user has used a premium plugin that has support for related posts exports hidden link

I hope this helps. Let me know if you have any questions.

#2111375

Thanks. I can't use the native export because I don't want to import all of the posts from my old site so I need a way of getting the relationships and associations into my new site and to be honest having already paid for one premium plugin I don't really want to use another. Is there any way to extract from the XML just the relationships and associations and make sure they relate the posts correctly in my new site?

#2111383

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Is there any way to extract from the XML just the relationships and associations and make sure they relate the posts correctly in my new site?
Well, maybe using custom code or specialized software. Otherwise, I don't see anyway.

I think that WP All Import plugin provides a custom code section. You may use it with a small function to generate the information of the related post to the exported file. Honestly, I never used it.
If you want to try it, you can use the toolset_get_related_posts function to get the related posts:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

Check these articles:
- hidden link
- hidden link

#2111469

I don't think toolset_get_related_posts will work so I went ahead and purchased Ultimate exporter and importer.

The export creates a csv with headers types_relationship and relationship_slug but for all of my CPTS all of the cells below these headers are empty. I wonder if there is something wrong with the architecture of my Toolset implementation. Are the relationships meant to be stored this way? can you help me understand where in the database they are stored per post?

#2111479

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

The relationships are stored in specialized Toolset tables. The following tables:
- wp_toolset_associations
- wp_toolset_associations_old: This table is not used anymore starting from Types 3.4
- wp_toolset_connected_elements
- wp_toolset_post_guid_id
- wp_toolset_relationships
- wp_toolset_type_sets

We have changed our relationships schema starting from 3.4, which was published on September 15, 2020. Maybe the plugin's authors did not update the plugin to handle this change. However, if they are using the supported API(toolset_get_related_posts) they should not have any issue with it.

I remember one case when WP All Import did not import the relationships after our upgrade, and the user that reported it has also reported it to the WP All Import team and they released an update.
https://toolset.com/forums/topic/imported-relations-are-stored-in-toolset_associations-but-not-shown-in-wp-admin/#post-1804029

#2113259

I have discovered a solution.

I can export/import XML files for each post type using the WordPress native import/export tool and then use WP All Export/Import to bring over all of the custom fields, using the "update existing posts" option.

The native XML import brings with it the relationships and so they are preserved.

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