Skip Navigation

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

Problem:
The client is experiencing issues with content imported as a draft not publishing correctly and the Region taxonomy not setting correctly after using WPML Export and Import. The content is in a secondary language without a default language version, which may be causing recognition and association issues.
Solution:
using the WPML All Import plugin fixes the issue. (https://wpml.org/documentation/related-projects/legacy-wpml-all-import/importing-multiple-languages-with-wp-all-import-and-wpml/)

If these steps do not resolve your issue or if the solution seems outdated or irrelevant to your specific case, we recommend opening a new support ticket. Additionally, we highly recommend checking related known issues at WPML Known Issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum 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.

This topic contains 0 replies, has 1 voice.

Last updated by chrisD-39 5 days, 16 hours ago.

Assisted by: Osama Mersal.

Author Posts
January 23, 2025 at 7:18 pm #16629515

chrisD-39

Background of the issue:
I am working to test migrating batches of content in a secondary language and setting a Category and a custom taxonomy called Region on each post. To do this, I am using a combination of WP All Import Pro and WPML Export and Import. Ideally, the content will be imported initially as a Draft, since the majority will be in a secondary language and not the default, and then I will use WPML Export and Import to connect the dots on the language side and publish all of the updated content. I have followed the documentation and video provided here: https://wpml.org/documentation/related-projects/wpml-export-and-import/preparing-import-files-for-wpml-export-and-import/ and then explored visibility further by following the documentation here: https://wpml.org/documentation/related-projects/wpml-export-and-import/managing-the-visibility-of-imported-multilingual-content/.

Symptoms:
The content either imports as a Draft and remains as a Draft (ignoring the _wpml_import_after_process_post_status field set up in my import template) or it imports as Published and will display the secondary language content in the wrong places on the front end until I run the WPML Export and Import. Additionally, the Region taxonomy is not being set correctly after running WPML Export and Import - the result is the default language version of the Region is applied incorrectly, breaking the translated taxonomy archive from correctly showing the content on the front end.

Questions:
How can I ensure that content imported as a Draft is published correctly after using WPML Export and Import?
Why is the Region taxonomy not being set correctly after running WPML Export and Import?

January 23, 2025 at 8:36 pm #16629867

chrisD-39

My test import to the sandbox site created has been done via WP All Import, but WPML Export and Import is not installed. When I try to install myself, I get an error. Right now, my import has happened, but the translation piece has not yet been run.

January 27, 2025 at 3:05 pm #16638475

chrisD-39

Checking in here. I'm unable to complete the test, because the WPML Export and Import plugin is not installed and active on the sandbox site that was set up. Could you please add that so I can complete the test?

January 29, 2025 at 8:38 am #16644863

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

I'm Osama from WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload.

I activated the "WPML Export and Import" plugin. Please replicate the issue and let me know the steps to reproduce it.

Best regards,
Osama

January 31, 2025 at 8:01 pm #16657148

chrisD-39

Thank you! I performed 2 tests on the sandbox site, with the following results.

Test 1:
Imported as a Draft with WP Alli Import and configured the _wpml_import_after_process_post_status column to declare that WPML Export and Import should publish the posts after processing. The result was the posts remained in Draft status, but the category did align successfully.

Test 2:
Imported as Published with WP All Import and created a second category that has the same name as it's English counterpart. Strangely, the posts were imported directly to the correct language without running WPML Export and Import, and the category was again aligned successfully.

I am going to try another test in my staging environment. The one thing this sandbox is missing is a custom taxonomy, which is a part of our intended use case. I'll update here once I've run more tests in our environment.

January 31, 2025 at 9:02 pm #16657210

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please take your time and let me know the result of the tests and if you need further assistance regarding the issue.

Best regards,
Osama

February 3, 2025 at 8:11 pm #16664355

chrisD-39

Still testing, but what is consistent between both environments is that there is no way to import the content, have it remain in draft status, and then have it publish once run through the WPML Export and Import process. In all of my tests, when I set the status to Draft in WP All Import and include a _wpml_import_after_process_post_status column in my import (as indicated in the instructions within the WPML Export and Import plugin), the posts remain in draft status.

If I import as Published, they are also not automatically kept in draft until after running the WPML Export and Import plugin.

Is there a way to import content in a secondary language and have it remain publicly hidden until after it is run through the WPML Export and Import process? We are planning to migrate tens of thousands of pieces of content, and this is a dealbreaker if this will not work.

February 3, 2025 at 8:34 pm #16664423

chrisD-39

My environment also does not correctly connect the taxonomies (Categories, plus custom ones) with the correct translation. They continue to be connected to the English original, but placed in the correct secondary language which creates a mismatch and breaks expected appearance in front end archives.

February 4, 2025 at 7:51 am #16665091

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for your update. Please share your file examples so I can test them on the sandbox site.

Best regards,
Osama

February 4, 2025 at 2:00 pm #16667132

chrisD-39

My test files have all been uploaded to the sandbox site and can be viewed by going to WP All Import > Manage Imports. Of note, we are using additional ACF custom fields with our import on our own environment, as well as custom Taxonomies - both through the Co-Authors Plus plugin and registered via the theme.

February 4, 2025 at 2:50 pm #16667443

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

I tried to import the test_import file from the sandbox site, and it worked as expected.

Please note the following:

1- You need to import your taxonomies in a separate file before importing the posts
2- You need to import the default language along with the translated language to have the same unique identifier and connect the translations
3- Set the status to Draft in All Import to keep it as a draft even after running the WPML Import Export function
4- You might need to manually connect the taxonomies after the import
5- There is a known issue while importing more than two languages

Best regards,
Osama

February 4, 2025 at 3:01 pm #16667524

chrisD-39

OK, this may not work for what we need then. Can you confirm the following?

1. We have content that doesn't exist in the default language, only the secondary. Is that why this is not working?

2. Is there a way to import the content as a Draft and then have it automatically publish after running WPML Import Export? Keeping it in Draft status afterwards will make us still need to manually publish tens of thousands of posts to maintain the original publish dates.

Additionally, I have the Categories already imported and connected in my test environment, and the issue persists that the content remains connected to the English version, even if the content is moved to the correct language. Is there a conflict somewhere else that could be causing this, based on the information provided about our environment?

February 4, 2025 at 3:19 pm #16667614

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

1) Yes, this may cause issues. WPML expects all content to have an entry in the default language, even if it's just a placeholder.
If an item exists only in a secondary language, WPML might not correctly recognize it, leading to import issues like missing translations or incorrect associations.

2) You can use WP All Import's "Import as Draft" option and a custom PHP function to publish the content automatically after import. For example:

function auto_publish_wpml_imported_posts() {
    global $wpdb;
    
    // Get all draft posts that were imported
    $posts = get_posts([
        'post_type'   => 'post', // Change if needed (e.g., 'product' for WooCommerce)
        'post_status' => 'draft',
        'numberposts' => -1
    ]);

    foreach ($posts as $post) {
        // Update post to published while keeping original publish date
        wp_update_post([
            'ID'            => $post->ID,
            'post_status'   => 'publish',
            'post_date'     => $post->post_date,  // Keep original date
            'post_date_gmt' => $post->post_date_gmt
        ]);
    }
}
add_action('init', 'auto_publish_wpml_imported_posts'); // Run on WordPress init

Please note the above code is an example, not a tested function.

However, if you set content to Publish upon import, WPML Export and Import temporarily switches it to Draft status. This happens in the background during the initial import process. Once you run WPML Export and Import to correctly apply language settings and translation links, it automatically publishes the content, respecting your original settings.

I tested the above functionality when importing a file containing the default language and the secondary one.

3) I'm not sure why the categories issue happens in your environment. Please try the minimal install test by deactivating all plugins except the active ones on the sandbox to see if the result would differ.

Did you test using the WPML All Import plugin? It's a legacy plugin, but it might be a best fit for your needs.

Best regards,
Osama

February 4, 2025 at 3:31 pm #16667654

chrisD-39

Thank you for this! I will work with the function provided to test again, and see if I can identify where the conflicts may be occurring. I will also try to test with the legacy plugin to see if that better suits what we are trying to accomplish.

Will update here and mark resolved if this solves the problems we are facing. Keeping open for now while I test.

February 4, 2025 at 3:38 pm #16667711

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Sure, please take your time and let me know if you need further assistance.

Best regards,
Osama