Skip Navigation

[Closed] Import to a field with multiple instances

This support ticket is created 4 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 4 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1560229
Screen Shot 2020-03-23 at 10.22.45 AM.png

I need to import URLs into a custom field (using WP All Import) called "delayed_images".

In Types I've set this field to accept multiple instances. I'm just wondering how/if this will work if I import various data points from the XML file into this one field.

So for example, in the import I add these elements to the delayed_images field (also see screenshot attached):

{Photos[1]/Photo[2]/MediaURL[1]}
{Photos[1]/Photo[3]/MediaURL[1]}
{Photos[1]/Photo[4]/MediaURL[1]}
{Photos[1]/Photo[5]/MediaURL[1]}
{Photos[1]/Photo[6]/MediaURL[1]}

1. Can you confirm that each of the URLs that's imported into the field will be added as a separate "instance"?
2. Do I need to add a separator between each url that's added (e.g. a comma)?

Thanks

#1560587

Hi, as far as I'm aware it's not a simple process with WP All Import to import fields that support multiple instances. You can add a comma separator and then use some custom code to split those apart into multiple field instances, as shown in this other post: https://toolset.com/forums/topic/importing-data-as-arrays-to-custom-fields-repeating-text-area/

#1561659

Christian, how is information stored in a Types custom field with multiple instances?

Based on WP All Import's documentation, I can use the Variable Repeater Mode (XML). The documenation is for Advance Custom Fields, but I'm hoping it would be a similar process for Toolset Types.

hidden link

Is the data for multiple instances saved within one database field, and if so, how does it look (i.e. comma separated)?

#1562691
Screen Shot 2020-03-25 at 9.34.55 AM.png

Data for multiple instances is saved in multiple postmeta entries. It is not saved in one field with some separator. So if the field slug is "my-slug" and a post has multiple instances of the my-slug field, there will be multiple entries in postmeta of my-slug associated with the same post ID. Here is a screenshot of postmeta for a repeating field.

The topic ‘[Closed] Import to a field with multiple instances’ is closed to new replies.