• Resolved aaron4osu

    (@aaron4osu)


    I have a custom post of Business and each Business has a primary category(parent) and secondary category(child) with taxonomy fields using Advanced Custom Fields. I’m going to be importing into a fresh install that doesn’t have any categories set yet and I’m importing from a spreadsheet. So my question is how do I identify or create the parent/child relationship? My spreadsheet has a column for the primary category(parent) and one for the secondary category(child). But how do I indicate that the secondary category is a child of the primary category(parent)?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    You’ll need some way for the import script to know which term is the parent of any particular child term. WP keeps track of this by way of the “parent” property of the WP_Term object, which is assigned the parent’s ID. Of course your spreadsheet cannot know what ID would be assigned, so the import script would need to define all the parent terms first so their IDs can be known when the children are inserted.

    Alternately, the script could bulk import everything first without concern for who is parent to whom. It’d then return and update all the children’s parent properties afterwards to establish the parent/child relationship.

    Thread Starter aaron4osu

    (@aaron4osu)

    thanks @bcworkz . So I would important them in first without identifying the parent child relationship. This would get all the categories (parent and child) into wordpress. Then, export the business listings with categories that now have an id. Then important them in with a connection? In that final step how would I create the parent child relationship?

    FYI.. I’m using wp-ultimate-csv-importer-pro to import?

    • This reply was modified 2 years, 2 months ago by aaron4osu.
    Moderator bcworkz

    (@bcworkz)

    That would work, provided the second importer tool is capable of creating the connection. However it is a more convoluted method than what I had in mind. I was thinking the creation of connections would still be part of the initial import, but in a second stage once all the IDs are known. There shouldn’t be a need for a second export/import process.

    If you were building a custom import tool, you can do whatever works. The key is the relationship needs to somehow be defined in the source CSV data. If you use an existing import tool, you’d need your source CSV data to define the connection in a way the tool is expecting.

    I don’t know how the importer pro tool would expect such a connection to be defined. If that is your tool of choice, I recommend asking through their dedicated support channel for guidance on how to define the connection in your CSV file.

    Thread Starter aaron4osu

    (@aaron4osu)

    thanks again @bcworkz… can you point me in the right direction on how to define the relationship? I don’t see an option in the import tool I’m using.

    Moderator bcworkz

    (@bcworkz)

    Sorry, I don’t know. I recommend asking through the importer’s dedicated support channel for guidance.

    As a wild guess, you’d need another column that indicates a term’s parent term where applicable.

    Thread Starter aaron4osu

    (@aaron4osu)

    I was able to figure it out using wp-ultimate-csv-importer-pro plugin. here is what I did if anyone else comes across this…

    1. Imported parent categories by themselves.
    2. Then, Imported subcategories using a csv sheet with pairs of parent and child categories, and used wp-ultimate-csv-importer-pro to identify the parent.
    3. then imported businesses as normal indicating parent and child categories.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to indicate a parent child category relationship when bulk importing’ is closed to new replies.