WP All Import plugin allows you to bulk import posts, pages, WooCommerce products, and other custom post types from CSV or XML files. Now, thanks to the additional extension WPML All Import, it is possible to correctly import this content in language context.
Here is a short video that illustrates the process of importing multilingual content using WP All Import and WPML:
Please note when setting the “Unique Identifier” (@3:34) (@4:57) choose “Connector” instead of “Title”.
To import multilingual content, you need to have the following installed:
- WP All Import plugin
- WPML plugin. We recommend getting the Multilingual CMS version.
- WPML All Import add-on (available from your WPML Downloads page)
* If you want to import WooCommerce products, you will also need WooCommerce Add-On Pro.
To import posts into your WordPress installation, prepare CSV files. You can do this by using any spreadsheet software, such as, MS Excel or OpenOffice Calc. Prepare separate documents for posts in the original language:
And for translation(s):
When the tables are ready, use the option to export content to CSV files (in OpenOffice Calc, click menu File > Save As and choose type CSV file) and give them meaningful filenames.
Remember: Please prepare separate files with meaningful names for each language. This is crucial for the successful outcome of the importing process later on.
Importing translated content is divided into two steps (more on this below):
- Importing content in the default language
- Importing content in the secondary language
During Step 2 you will have to choose from a list of already imported files (the ones that should be connected in language relation). Selecting meaningful names will make this much easier.
We need a way to inform WP All Import that a row from one file is the translation of the other row from another file. To do this, add a column to your files that will inform WP All Import and WPML that the given row has a translated post coming from a row of the other file. This will be a Unique Identifier value.
In WP All Import you use this field to identify every single item to import – with WPML we will use it also to identify to which group this post belongs. By looking at this ID, you can tell which post is the translation of another by finding the same ID number.
You can name this column anything you like. In the example below, I call it “Connector.”
As you can see in the above screens: we have 2 CSV files English (original) english-posts.csv and Polish polish-posts.csv
The column called “Connector” groups the translations. Lines in different files (languages) that have the same “Connector” value will be considered as translations. In this way, “Hello World!” has a Polish translation of “Witaj świecie!”
Before we proceed to a description of how to import posts, let us stop for a moment to consider the case when you are importing posts with taxonomies (categories, tags, or custom taxonomies). In this case, you must create the exact same taxonomies before importing the posts. This can be done in two ways:
- Create the terms manually and translate them. You need to make sure that the terms that you create match the ones you included in your CSV file. Then, when you translate the terms, you need to ensure that the translation also matches the terms included in your secondary language CSV file.
- Prepare CSV files to import the taxonomies along with their translations. You just need to add the “Connector” column to all CSV files as we mentioned earlier in this tutorial to link each taxonomy term with its translation. Check out WP All Import guide on importing taxonomies. When importing the terms, make sure you follow the instructions described in the upcoming “How to import posts” section to set the import language.
It is worth mentioning each time you import posts/custom posts types that are associated with taxonomies, you need to import the taxonomy terms first then import the posts. However, if you want to import posts with terms that already exist and are already connected in a language relation, WP All Import will recognize it and set everything correctly if the taxonomies and translations are already created/prepared in the new site.
If the term in the default language is not exactly the same as the term in secondary languages, you can easily fix this: simply go to the taxonomy edit screen, display the translated terms, click the link to edit it, and then choose the original term from the This is a translation of field:
Importing posts (or other post types) does not differ much from importing them when WPML is not activated: you do this according to instructions provided by WP All Import documentation authors.
Prepare your CSV/XML file with posts in the default language, as described above. Then start importing following the usual importing process.
On the main screen, you will see a WPML Add-On metabox. Make sure that the correct language is set:
Now follow the usual process.
Choose the file with the posts in the second language. Proceed as usual as you do when creating new items, but in the WPML Add-On metabox, you will have to choose the correct secondary language. In addition, expand the Automatic Record Matching to Translate section and perform the following steps:
- Select the file that you used to import the default language posts. (When you perform multiple imports, the list of files to select will, of course, be longer.)
- Drag the field that you are using as the “connector” (see above) to the Unique Identifier field. This Unique Identifier field must be exactly the same as the Unique Identifier of the default language import.
- Set the unique identifier for the secondary language import to match the one you choose when importing the default language.
That is it. Now proceed as usual, and this import will finish with posts in the second language that will be connected to the originals.
Because WP All Import relies on the Unique Identifier to connect translated posts with their counterpart default language counterparts, you cannot simply upload the secondary language file to add translations. If you do this, WP All Import will not know which posts the translations belong to.
To do this:
- Export your default language content using WP All Export.
- Edit the newly created CSV to add a column for the Unique Identifier.
- Import this default language file with the new column, being sure to use the Update option.
Once the default language file has been imported, you can continue with your secondary language file as previously explained.
Importing WooCommerce simple products does not differ much from importing regular posts, as described above.
However, if you need to import WooCommerce variation products, you may need to consider some additional steps. Luckily, the team behind the WP All import plugin has prepared a very nice tutorial where they explain step by step how to achieve this. Don’t forget to add the Unique Identifier column, as explained above!
Now that you have imported your original variable products, you need to import their translations. Besides the extra considerations for importing variable products discussed in the tutorial linked above, there is no difference when importing other post translations: prepare your CSV/XML files, add the right language on the WPML Add-On metabox and assign a Unique Identifier (connector). And it is ready to go!
If you want to import translations for products with taxonomy terms, you must translate those taxonomy terms before importing the products. There are two ways to do this: by creating and translating a temporary page or by manually translating your taxonomy terms.
Create and translate a temporary page:
- Create all of the taxonomy terms in the original language.
- Create a temporary page or a post.
- Assign all of the taxonomy terms to your temporary page.
- Send this temporary page for translation.
When you translate the temporary page all taxonomy terms can also be translated and saved. You can then delete this temporary page.
Manually translate your taxonomy terms:
- Create all of the taxonomy terms in the original language.
- Go to WPML → Taxonomy Translation and manually translate taxonomy terms.
Now you can run the import process for translated posts. Import will automatically link translated posts with translated taxonomy terms.
To import products with manually set prices for other currencies, make sure to
set the relevant fields in the WooCommerce Add-On section for the default language import. This includes the regular price and sale price.
Additionally, you need to add the following custom fields in the default language import in order for the set prices to show correctly on the secondary language products’ pages. In our example, we have manually set prices for products in Euros. Hence, we have added the following custom fields:
As you may have noticed, some of the custom fields have the suffix _EUR. Depending on the currency you have set prices for, you need to change this suffix to match the currency code. You can get any currency code by navigating to WooCommerce → WooCommerce Multilingual. Go to the Multi-currency tab and click on the Add currency button. There, select the currency to get its code.
If you are importing products in more than one language and they all have manually set prices for all other currencies, make sure to add custom fields associated with all the currency suffixes.
WPML and WP All Import do not have an option to export posts from a WordPress installation; this is out of scope for these plugins. If you want to save a backup of your posts, you need to think about other options.
The first thing you may think of is the standard WordPress option to export content to XML files (Tools > Export). However, you will have to split those files into many (one for each language) and add an XML element with a Translation Group ID. Editing XML files is not very easy. Hence, I suggest avoiding this method of exporting content.
It will be much better to create CSV files: it is easier to split them by language and to add a column with a Translation Group ID. You can use one of these plugins as a start: WP CSV Exporter or WP CSV. Then you should divide the exported files into many (one file per each language) and add a column with information about the Translation Group ID.
You can do this manually. However, if you are a programmer, you can parse those files in PHP and for every row check the translation of the given post. You can do this with the filter wpml_object_id.
Migrating from a custom database with different tables into WordPress can be a challenging task. Fortunately, you can accomplish this using Toolset plugins and WP All Import. Check Toolset’s guide on importing a database into WordPress. The video below illustrates the migration process in details:
In case you need help using WPML All Import, visit WPML’s support forum.