-
Notifications
You must be signed in to change notification settings - Fork 6
Import a wpml Export into a MultilingualPress Multisite
To import your content you have two options. The first one is to use WP-CLI. WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. The second option is to use the WordPress Importer. On this you have to connect the Languages manually!
- Import via wpcli - the prefered way!
- Import via WordPress Importer - the elaborate way but it works
##Import via wpcli
###Preparation
- Install WPML to MLP by checking out this github repository. After that, change to the plugin directory and run
$ composer install --prefer-dist --optimize-autoloader --no-dev
. - Create a directory log/ inside your wp-content directory and make sure PHP process user has write access to it
- Create/setup a WordPress multisite and install MultilingualPress networkwide. Create a site for each language and setup the language-linking in the MultilingualPress settings
- Make sure your original site is available via HTTP from the importing system.
###Start the import The following descriptions assumes that you set up a multisite with these sites:
-
example.dev
foren_US
-
es.exampe.dev
fores_ES
First import the english content:
$ wp w2m import /path/to/wpml_export_en_US.xml --url=example.dev
Start import to blog 1[en_US]? [yes]
Type in yes
to proceed. You can add the parameter --verbose
if you want. You can also follow the logfile in wp-content
(within another shell) to see what going on:
$ tail -f /path/to/wp-content/log/w2m-import-{DATE}.log
This process will, at the end, generate a report file inside the wp-content/log
directory. This file is important for
all the following imports. (E.g. wp-content/log/w2m-import-report-1456761758.json
).
Now import the second language:
$ wp w2m import /path/to/wpml_export_es_ES.xml --url=es.example.dev --map_file=/path/to/wp-content/log/w2m-import-report-1456761758.json
Start import to blog 2[es_ES]? [yes]
This will import everything and link it to the english content. It will create another report file. But for every following import (if you have more than two languages) you can still use the first report file.
The plugin export and import every WordPress default data structure like posts, pages, categories, tags, metas and users.
If you use plugins that creates custom tables (e.g. WooCommerce) you have to copy these tables manually to every new site.
ID references in these Tables must be updated following the ID map in the report file. In bin/
there's a script that creates
SQL update statements out of the report file. E.g. the table wp_3_woocommerce_orders.product_id
contains post IDs. To generate
the SQL update command call the script like so:
$ cd bin/
$ ./sql-replacement-query.php wp_3_woocommerce_orders product_id post < wp-content/log/w2m-import-report-1456761758.json > update.sql
This will generate a file update.sql
that can be passed to your database like so:
$ wp db import < update.sql
To automate table-coping we provide a plugin https://github.com/inpsyde/wp-db-tools-cli which helps you to script these tasks:
$ wp db_table wp_table wp_2_table --content
##Import via WordPress Importer
###Preparation
- Install WPML to MLP by checking out this github repository. After that, change to the plugin directory and run
$ composer install --prefer-dist --optimize-autoloader --no-dev
. - Setup a WordPress Multisite & install the Plugin MultilingualPress
- Setup for every language a site at your Multisite and connect the languages
- Install the Plugin WordPress Importer
- Make sure your original site is available via HTTP from the importing system.
###Start the import
Activate the plugin WordPress Importer network wide. Switch to the site wich language you want import. Goto Tools->Import->WordPress
upload your wpml export, click import. After this all post of this language will importerd. Do this for all your languages.
You have all content at every language impoerted? Now you can connect the languages post per post. Goto a post, page or coustom posttype and scroll to the translation metabox, click on the button Change relationship
, chose Select existing post …
, chose the right translation an and save this.