Repeater Fields

Repeater Fields

Our ACF add-on for WP All Import provides 3 modes for importing to repeater fields. The option to use depends on the type of file you are using, as well as the way your data is structured.

Note: Importing data from several records into a repeater field for a single post is not supported. All of the data for a repeater field must be present in the same record.

So for example, while the data in the 「Sizes」 column in this file can be imported into a repeater field, due to the data being in the same record:

ACF Data Structure

The data in the 「Sizes」 column in this next file will not be imported as desired, since the data is spread out across several records:

Incorrect Data Structure

Depending on the import settings, either a separate post would be created for each row, or only the 「Large」 value will be present in the repeater field for 「Test Post」 (since the prior values that were imported would be overwritten).

Fixed Repeater Mode

Use Fixed Repeater Mode when each piece of your repeating data is stored in separate columns or elements. For example, if you have a repeater field containing an image, and your CSV file has 5 columns – image_1, image_2, image_3, etc:

Fixed Repeater File

Then you should use Fixed Repeater Mode. Manually add 5 rows to the repeater by clicking Add Row:

Fixed Repeater Add Row

And then drag & drop image_1 to the first row, image_2 to the second row, etc.

Check the 「Ignore blank fields」 box if some of the records in your file don』t contain values for all 5 images. For example, if image_3 and onwards are blank for a certain record, WP All Import will only add 2 rows to the repeater for that record.

Variable Repeater Mode (XML)

Use this option if your repeating data is stored in XML format as 「sibling」 elements, for example:

image1.jpg
image2.jpg
image3.jpg
image4.jpg
image5.jpg

Dragging & dropping won』t generate the correct XPath expressions when using Variable Repeater Mode (XML). You need to modify your XPath expressions as per WP All Import's FOREACH syntax.
In this video 「Variable Repeater Mode (XML)」 is used.
Variable Repeater Mode (CSV)
If your repeating data is stored in a single column in your CSV file, and is separated by a separator character, use this option.
For example, if you have a repeater field containing ingredients (Name and Measure – i.e. 1/2 cup is the measure and butter is the name), and the names & measures are stored in separate columns in your CSV file:
Variable Repeater CSV

Then use this option. Since this repeater data is comma separated, change the 「Separator Character」 setting from a pipe character to a comma, and drag & drop the Names & Measures columns into the appropriate sub-fields in the repeater field. The end result should look like this:

Variable Repeater Mode

When the data is imported, the first item in the Names column will be associated with the first item in the Measures column, the 2nd item in the Names column with the 2nd in the Measures column, etc.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注