How to Map Custom Fields

How to Map Custom Fields

Mapping is used when the value you need imported to your site is different than the value in your file. A visual interface is available for mapping for Custom Fields and Custom Taxonomies. To map elsewhere, you can use a custom PHP function.

Visual Mapping Tool

For example, you may have a file with product categories that are written in Dutch, but you want to import these products to categories that already exist on your site with English names.

Or, your theme or plugin requires the value of a Custom Field it uses be either 1 or 0, but in your XML or CSV file, the values are expressed as Yes or No.

You need to map the values in your file to the values you actually imported to your site.

Example – Mapping For A Dropdown

In the previous article, Importing to Theme & Plugin Fields, we explained how to detect the fields used by your theme or plugins, and their possible values.

Our theme has a dropdown to specify whether a Property Listing is for rent, or for sale.

Rent or Buy Example

The field name is 「rob_value」, and the possible values, as stored in the database, are 「Rent」 and 「Buy」.

Field Example

Note: You can see the values as they are stored in the database by clicking inside the Value textbox for the 「rob_value」 field in WP All Import. The values stored in the database may not be the same as values shown inside the select box in the theme. We must map to the values as they are stored in the database.

Our XML file has a element that is set to FORSALE if the property is for sale (Buy), and FORRENT if the property is for rent (Rent).

XML Data

Without mapping, simply dragging & dropping to the Value box for rob_value would not work, because the value of is not correct for our theme.

To solve this problem, we use the Mapping feature.

Mapping

Click Field Options… and then click Mapping.

A dialog box will pop up allowing you specify the mapping rules.

Mapping Rules Example

Now, when the import is run, FORSALE in your file will be translated to Buy, and FORRENT in your file will be translated to Rent, so your data will be imported correctly, as per the requirements of your theme and plugins.

发表回复

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