Mapping & Translation

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 the wpai_util_map function.



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 dropdown to specify whether a Property Listing is for rent, or for sale.



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



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 <rentorbuy> element that is set to FORSALE if the property is for sale (Buy), and FORRENT if the property is for rent (Rent).



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

To solve this problem, we use the Mapping feature.



Click Field Options… and then click Mapping.

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



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.