Tell us what you are trying to do?
I need to import 700+ posts to a Toolset custom post type that has custom taxonomies, custom fields and a custom field group with 3 fields in it. I know how to add the regular custom fields and how to put the posts in the right taxonomy terms and add the term if it doesn't already exist. I can't find any documentation on how to add the custom field group to the post (some could have 8 or more instances of the group and its fields).
Do I just create a post in the custom field group's post type and add the fields then connect it to the parent post as a parent child relationship or is there a Toolset API that makes this simpler?
Is there any documentation that you are following?
Could not find documentation that explains this process.
Is there a similar example that we can see?
Not that I know of.
What is the link to your site?
There's nothing on the site for this yet. I'm trying to build the code to do the import and this is the last piece I need to add and test.
Hello,
I suggest you try these:
1) In the original website:
Dashboard-> Toolset-> Export/Import
Export the Types setting file, it should be able to export all Toolset Types plugin settings into one file.
Dashboard-> Tools-> Export
Find and export your custom post type posts data, this should be able to export posts contents/taxonomies/custom fields values
2) In the target website:
Same as above import the Types setting files + post data
More help:
https://wordpress.org/support/article/importing-content/
I guess I wasn't clear. The data isn't coming from WordPress / Toolset. It is in a CSV file. There is no existing Toolset post / taxonomies / fields to export out then import in from.
I didn't ask how to use someone else's importer. I asked how to add repeating fields via PHP which is a topic missing from Toolset's developer documentation.
Also, I already invested in WP All Import, at Toolset's advice but they don't handle repeating fields yet. I'm not going to spend more money on Ultimate CSV Importer.
Because I solved the problem myself after some further experimenting, you can close this ticket. For others interested in the solution, I basically did what I asked about above:
Create the new CPT, put it in any taxonomies that are needed, add any non-repeating custom fields that are needed. Then create another new post using the custom field group's post type (the slug for the repeating field group), add the individual fields to this post, then connect this post to the first post using the correct relationship slug and the Toolset Connect Post API.
You can use WP built-in function add_post_meta() to add items into multiple instances field, see the document:
https://codex.wordpress.org/Function_Reference/add_post_meta
As your request, closed this ticket