WPML Export and Import is currently in its alpha stage. Only install this version on a test site, not a live one.
Test this version with your favorite import plugin or tool. Please share any issues or bugs you find. Your feedback will shape WPML Export and Import’s final version.
On This Page:
- Getting Started
- How WPML Export and Import Works
- Preparing Your Import File
- Importing Multilingual Content with an Import Plugin
- Running WPML Export and Import
Getting Started
Start by installing and activating the following plugins:
- Your preferred WordPress import plugin or tool
- WPML core plugin (while optional, we also recommend activating the String Translation add-on)
- WPML Export and Import add-on (available from your WPML Downloads page)
New to WPML? Check out our Getting Started Guide.
How WPML Export and Import Works
WPML Export and Import offers a straightforward way to add and manage multilingual content. Instead of syncing with a WordPress import plugin, it separates the import process from the language adjustments.
You can also choose your import workflow. This allows you to import all of your multilingual content in one import file, or create separate import files for each language. If you do decide to import each language separately, you need to ensure all languages are imported before running WPML Export and Import.
Here’s how it works:
- Prepare your import file(s): Include language columns in your import file(s). This links your main language content with its translations. If you are importing posts, you can also indicate the final post status.
- Do the import: Import the multilingual content with your chosen plugin, as you always do.
- Adjust languages with WPML Export and Import: After importing, go to WPML→ Export and Import. WPML Export and Import sets the language of your content and ties translations together. Just press a button and watch it work.
Preparing Your Import File
To set the language of your content and link translations, WPML Export and Import relies on specific language columns in your CSV or XML file.
Many import tools rely on their own custom fields, but WPML Export and Import uses WordPress’s native mechanism: meta fields. WordPress stores extra info (also known as metadata) about posts and taxonomy terms using meta fields. This includes language information.
Your CSV or XML file can use any column names. However, using the reserved fields defined below may make it easier for you to map the columns of your CSV file to the custom fields of your WordPress site:
- _wpml_import_translation_group – A value shared by the default language items and the translations. For e-commerce sites, this can be the SKU. You can also use the trid (translation ID group).
- _wpml_import_language_code – The language code(s) of each of the items you’re importing, for example en, es, fr.
- _wpml_import_source_language_code – The source language code for the imported translations. This field is required for translations. For the source language content, you should leave this field blank.
Here’s an example of a multilingual import file:
Preparing an Import File Using the Built-In WooCommerce Exporter
If you export products in WooCommerce using the built-in Export feature, use the language switcher at the top of the page to switch between your languages and generate a CSV file for each language. WPML Export and Import will automatically add the language columns to each of the generated CSV files.
When you import these files to another site using the built-in WooCommerce Import feature, WPML Export and Import handles the mapping of the multilingual columns to product custom fields for you. You can run the importer without making any manual edits or changes to the import files.
Setting a Post Status Before Importing
If you’re importing updates, you can keep already-published content as it is. For a smooth workflow, we recommend that you import new posts as Drafts.
This is because after importing with your preferred tool, your items won’t yet display under the correct language. In most cases, your imported content will be grouped together under All languages or your site’s default language.
By importing posts as drafts, you avoid showing mixed languages on the front-end of your website. And, you don’t need to later update the post statuses manually. You can tell WPML Export and Import to update the final post status.
To do this, add the _wpml_import_after_process_post_status field to your import file and tell WPML Export and Import what you want the post’s final status to be after it completes.
If you do not set _wpml_import_after_process_post_status, WPML Export and Import concludes your imported posts are already in their final status.
Importing Multilingual Content with an Import Plugin
Now, use your preferred plugin or tool to import your XML or CSV file to WordPress.
As an example, we used the WP All Import plugin. Below, you can see how we mapped our language columns to the Custom Fields.
As expected, after completing the import, the content is not yet assigned to the right language. In our case, everything is grouped under All languages.
Running WPML Export and Import
To make the language adjustments to your imported content, navigate to WPML → Export and Import.
If your imported content is ready to be processed by WPML Export and Import, you’ll see a button titled Run WPML Import. Click on it and let WPML Export and Import automatically go through the steps. The last steps include cleaning up the multilingual metadata, ensuring a tidy database.
Once the import completes, you should see your content assigned to the correct languages and linked to translations.
Running WPML Export and Import with WP-CLI
If you use WP-CLI (the command-line interface for WordPress), you can run WPML Export and Import by using the wp wpml import process command.