Skip Navigation

[Resolved] Import posts with CSV

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can we import posts to Toolset with CSV?

Solution:
Yes:
https://toolset.com/documentation/user-guides/importing-content-from-csv-with-post-relationships/

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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 6 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#876605

Hello i have:
parent post type:contatto
child post type: corso
all is created with types

Tell us what you are trying to do?
I'm trying to import custom post types with parent/child relationship

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/import-csv-ultimate-csv-importer-plugin/

i can import correctly fields i want, but i can't manage to import child posts in right parent.

I know there is a hidden field _wpcf_belongs_{my-parent-slug}_id, the problem is that Ultimate CSV Importer does not import manual post ID, simply don't work.

There is something i'm missing?

Thanks for any help

#876662

Well, I see that this DOC completely misses the parent/child relationship.

I explained it once here, for another Plugin:
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/import-content-csv-importer-plugin/#importing-types-post-relations

You need to map the Custom Field _wpcf_belongs_parent-post-type-slug_id (where you need to adapt the parent-post-type-slug part) and populate this field with the ID of the parent Post (that must exist already in the system, otherwise you will have no ID at disposal)

The new RC versions downloadable in the Beta area of Toolset should provide better methods as the relationships API changed, although, that not work with the current stable Toolset:
https://toolset.com/documentation/user-guides/importing-content-from-csv-with-post-relationships/

#877266

Hello Beda and thanks for help.

I can correctly map fields, also _wpcf_belongs_contatto_id, i think my problem is on importing parent post:
i cannot specify a exact post_ID importing, so i have 30.000 "contatti" with nearly random post_ID and i cannot import 30.000 "corsi" without become crazy.

There is a way to force a post_ID importing a post?

#878819

Post ID's are something unique for each post, and they are required to be stored in the Database.

The Toolset Relationships as for now store that ID of the parent posts, in the Child Posts' field.

This ID must be known to import Child posts properly.
Hence, first, you should create or import your Parent Posts.
That will generate the ID's that you can use to populate your Child Posts Fields

Wherever the source of those Parent Posts is, whether you import it with CSV or programmatically, WordPress will create the ID of the posts, not the CSV file.

Later, when the posts are created, their ID can be used to populate the Child's posts CSV import sheet.