Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are experiencing issues with WP All Import where products are being imported into a different language than the one you set during the import process.
Solution:
We are aware of this issue and it will be resolved in the next release of the WPML Export & Import plugin. Please keep an eye out for the upcoming release. We will announce it through a blog post and provide detailed documentation on how to implement this. We recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

If this solution becomes outdated or does not apply to your case, please open a new support ticket. We highly recommend visiting our support forum for further assistance at WPML Support Forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 6 replies, has 1 voice.

Last updated by Andrey 3 days, 3 hours ago.

Assisted by: Andrey.

Author Posts
May 7, 2025 at 9:02 am #17005169

Ralph Klerk

Background of the issue:
I am trying to import products (property-listings) to our site using WP All Import and WPML All Import. The main language of the site is Dutch, and the secondary language is French, which is hidden on the frontend. All products should be imported in French and are translated to Dutch if needed. This process works fine when running the import from the backend. However, when using the WP All Import cron task, all products are imported/updated to Dutch. I attempted to force the language before the import with $sitepress->switch_lang('fr') or do_action('wpml_switch_language', 'fr'), but it had no effect.

Symptoms:
When running the import using the WP All Import cron task, all products get imported/updated to Dutch instead of French.

Questions:
Could the issue be related to the fact that French is hidden?
Why does forcing the language before the import have no effect?

May 8, 2025 at 8:53 am #17010318

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

When WP All Import is triggered via cron, I believe that WPML defaults to the site’s main language (Dutch) unless we explicitly set it.

What if you try this?

add_action('pmxi_before_xml_import', function($import_id) {
    if (defined('DOING_CRON') && DOING_CRON) {
        global $sitepress;
        $sitepress->switch_lang('fr');
    }
}, 10, 1);

This is based on hidden link

This should ensure that whenever the import runs via cron, WPML is switched to French before any data is processed, so all products are created or updated in the correct language.

Can you try this?

May 8, 2025 at 11:55 am #17011417

Ralph Klerk

Hi Bruno, unfortunately this doesn't work using the wp all import cron. I've logged the language using:

$my_current_lang = apply_filters( 'wpml_current_language', NULL );
echo $my_current_lang;

After your code and it returns the main language of the site (nl).

To be clear: I've checked your code when we are logged in in the back-end and run the cron in the same browser/window. Then it does return the desired language (fr).

So it seems to be related to the login state and the hidden language not being available for the (WP All import) cron.

Any way to force this somehow?

May 9, 2025 at 2:48 pm #17017142

Bigul

Hello,

Thank you for the updates. Please note that with WP All Import Pro and the WPML All Import Glue plugin, the recommended workflow is to first import products in the default language and then import the translated versions separately. It is not possible to import products directly into a secondary language. Therefore, it is an expected result now.

So I shared the details with our second-tier team for further checking. We will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

May 12, 2025 at 8:44 am #17021519

Ralph Klerk

Hi Bigul, I think your remark regarding

"It is not possible to import products directly into a secondary language. Therefore, it is an expected result now. "

isn't right, because it works perfectly on some of our others sites and the only difference is that we have our secondary language hidden on this one. Hopefully your second-tier team has some hints/a workaround.

May 13, 2025 at 6:47 am #17025290

Bigul

Hello,

Thank you for the updates. The ticket has been escalated to our developers as a feature request. We will get back to you as soon as we have feedback. Thank you for your patience, and please stay tuned.

--
Thanks!

Bigul

September 18, 2025 at 6:53 pm #17414575

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Just a quick follow-up on this issue: it will be resolved in the next release of the WPML Export & Import plugin.

Please keep an eye out for the upcoming release. It will be accompanied by a blog post announcing the new feature and providing a link to detailed documentation on how to implement it.