Skip Navigation
Updated
October 17, 2024

Learn how to add language columns to spreadsheets for importing multilingual content into a new site, allowing WPML Export and Import to assign language details and connect translations.

When You Need To Manually Prepare XML or CSV Files

If you use supported plugins for migrating content between WordPress sites, WPML Export and Import will automatically add language details to your files. 

However, there are times when you might need to create the CSV files yourself, for example:

  • You maintain multilingual content in spreadsheets and you want to import the content directly from the spreadsheet
  • Your export plugin isn’t yet supported by WPML Export and Import, so the CSV or XML file your export plugin generates doesn’t automatically include the language information

In these cases, you’ll need to manually add the language information to your spreadsheets. You’ll learn how to prepare the file below, but you can also watch our step-by-step video for a visual explanation.

Required Plugins

Install and activate the following plugins on the site you’re importing to:

  • Your preferred import plugin
  • WPML 
  • WPML String Translation
  • WPML Export and Import
  • WooCommerce Multilingual and Multicurrency (only if you are importing WooCommerce products)

1. Create Spreadsheets with Language Columns 

Depending on your import tool, you may need to prepare one or two spreadsheets.

For WP All Import Pro and similar import plugins, create two spreadsheets:

  • One for taxonomies (e.g., categories, tags, product categories).
  • Another for posts (including pages, products, and other post types).

For the native WooCommerce CSV Importer, you only need one spreadsheet, with product categories included within the rows that detail the products themselves.

Each spreadsheet should include the usual content details along with three crucial language columns for WPML:

  • _wpml_import_translation_group: Use this column for a unique value that associates the default language content with its translations. For e-commerce sites, use the product’s SKU. If there’s no SKU, use a Translation ID (trid).This is an ID number you create, which should be the same for each piece of content and its translations.
  • _wpml_import_language_code: Indicate the language code for each item, for example en for English, es for Spanish). Refer to ISO standards for custom languages (e.g., “es-MX” for Mexican Spanish).
  • _wpml_import_source_language_code: Use this column to specify the original language code of the content. This field is only necessary for translations and you can leave it empty for content in the source language.

Here’s a summary of the information your spreadsheet(s) should contain:

Taxonomies Spreadsheet

Term ID (use existing term IDs if you’re updating terms already on the site)

Name and slug

Parent ID, name, and slug (if applicable, add parent items before children)

Post Types Spreadsheet

Post/Page titles

Post/Product IDs

Main content and featured image URLs

Assigned categories or product categories

Parent-child relationships (if applicable, list parent items first)

*(WooCommerce only) Product type, attributes, and prices

*(WooCommerce only) Product variation ID and parent product ID

Taxonomies Spreadsheet

_wpml_import_translation_group

_wpml_import_language_code

_wpml_import_source_language_code

Post Types Spreadsheet

_wpml_import_translation_group

_wpml_import_language_code

_wpml_import_source_language_code

Remember that IDs play a very important role in your spreadsheet:

  • If you’re adding new content to your site, ID columns help import plugins understand relationships between items. They identify parent-child relationships.
  • If you’re updating content that already exists on the site, you need to use the exact IDs that your posts or products currently have. This ensures accurate updates and avoids duplication or errors. For content with parent-child relationships, import parent items and their translations first, then use these IDs in the ‘Parent ID’ column of your spreadsheet.

2. Import the Multilingual Data

Once you save your spreadsheets as a CSV or XML file, go to your new site and set up WPML with the languages you plan to import. Then:

  • Import the taxonomies first (if applicable)

 By importing categories, tags, or any other taxonomies first, you lay the foundation for organizing your content on the new site.

Each import plugin has its own interface and steps, and your import plugin will likely require you to match or “map” the column names for categories from your CSV to fields. This is a critical step for enabling WPML Export and Import to update language information correctly. 

For example, if you’re using WP All Import Pro:

  1.  Expand the Term Meta section in Step 3. 
  2. Add three term meta fields and drag the language columns to the Value fields. Use the column names from your spreadsheet, without brackets, for the Name fields.
Mapping the language columns in the Term Meta section

Steps may vary with other plugins, but it’s very important to map these fields correctly.

  • Next, import your post types (posts, pages, products, and any other content types)

Once again, you will need to match or “map” the column names for product data from your CSV to fields. 

If you’re using WP All Import Pro:

  1. In Step 3 of the WP All Import wizard, scroll down to the Custom Fields section.
  2. Add three custom fields and drag & drop the language columns from the right sidebar to the Value fields. For the Name fields, use the column names without the brackets. Again, this step might look different if you use another importing plugin, but you must map this information for the import to work.
Mapping language fields to custom fields in WP All Import Pro

Until you run WPML Export and Import, all your imported content will be grouped under one language. If you’re using a supported import plugin, WPML Export and Import will temporarily set imported content to Draft status to prevent mixed languages on the front-end. For unsupported plugins, you need to set the publishing status yourself. 

Learn more about managing the visibility of imported content.

3. Run WPML Export and Import

With your multilingual content imported, go to WPML → Export and Import and click Run WPML Import. It may take a few minutes for WPML Export and Import to go through the steps of adding the language information and connecting translations.

After WPML Export and Import completes its update process on your imported content, review your posts, pages, products, and taxonomies. 

Do this check on both the backend and front-end of your site. Make sure that each item of content correctly appears under the correct language and that the translations are properly linked. If you find any taxonomy translation missing or not properly connected to the default language term, you’ll need to manually connect the taxonomy translations.