-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Hi WP-CLI Team,
While working on a multi-language site which uses Polylang I noticed that translations get damaged after running import via CLI. The same WXR works fine from admin UI (Tools -> Import). Polylang leverages heavily custom taxonomy and custom post types to store translations and trac related posts and terms (i.e. variants of the same entry in different language). After a short investigation I figured out that Polylang comes with a custom PLL_WP_Import class [1], derived from the regular WP_Import, which implements the special handling of Polylang entities during import.
In admin page the standard WP_Import gets swapped with PLL_WP_Import by removing the regular WordPress action and adding Polylang variant in the same place [2]. In CLI there doesn't seem to be any API which would allow for that.
I came up with a rather rudimentary patch [3] which will fork fine for my project. I wonder if you'd be interested in pulling it. Anticipating your question - I didn't investigate other translation plugins or run any tests except smoke-testing it against my development instance.
Cheers,
Bartosz Moczulski
References:
[1] PLL_WP_Import = https://github.com/polylang/polylang/blob/master/integrations/wp-importer/wp-import.php
[2] WP_Import -> PLL_WP_Import replacement = https://github.com/polylang/polylang/blob/master/integrations/wp-importer/wordpress-importer.php
[3] my humble change = bmoczulski@e493025