Skip Navigation

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

Problem:
The client wants to clean up the translation statuses of existing content before adding a fifth language to their multilingual website. They are looking for a way to bulk update the translation statuses without relying on additional plugins.

Solution:
1. We recommend bulk editing and saving the translated contents to resolve the issue. A plugin like Bulk Editor could be useful.
2. When making minor edits to the original content, use the "Minor Edit" checkbox in the WPML language options within the WordPress Editor to prevent the translation status from changing.
3. Avoid translating content with the WordPress Editor if the WPML Translation Editor is the defined method for translating that content, as manual edits could be overwritten.
4. If you prefer a programmatic solution, you can add the following code to your theme's

functions.php

file, but please ensure you back up your site and database first:

add_action( 'admin_init', 'save_all_posts_on_refresh' );
function save_all_posts_on_refresh() {
  global $pagenow;
  if ( $pagenow == 'edit.php' ) {
    $args = array(
      'post_type' => array('page', 'post'),
      'numberposts' => -1
    );
    $all_posts = get_posts( $args );
    foreach ( $all_posts as $single_post ) {
      wp_update_post( $single_post );
    }
  }
}

After using this code, remember to remove it from the

functions.php

file.
5. WP All Import is not a solution for this issue as it requires an import of original products as a reference to connect the imported translations.

Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If so, we highly 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 the issue persists, please open a new support ticket with us.

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 3 replies, has 2 voices.

Last updated by Andreas W. 9 months, 4 weeks ago.

Assisted by: Andreas W..

Author Posts
February 1, 2024 at 1:36 pm #15255228

T4ng

The website I'm working on has already 4 languages, and many different posts (of different post types).
Many of this content had to be edited manually (slight design customization along languages wouldn't allow text-only translations).
Because of typos here and there, I sometime edited the original content most recently, so that many contents are tagged as "Needs update".
I'm about to add a 5th language, but first would like to cleanup the translation statuses of the existing content.
How can I do that?
Thanks

February 1, 2024 at 7:19 pm #15256682

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

If you bulk edit and save the translated contents it should solve this issue.

You could try this plugin:
https://wordpress.org/plugins/bulk-editor/

Further, take note, that in the right sidebar of the WordPress Editor on the original content, you will find a field "Minor Edit" inside WPML's language options.

If you mark this checkbox before saving the content, then the translation status will not change.

Also, please make sure to not translate content with the WordPress Editor if the WPML Translation Editor is defined as a translation method for this content.

If you make manual edits on the translation and then use the WPML Translation Editor, your prior edits will get overwritten.

Each original content has its translation method settings inside the right sidebar of the WordPress Editor.

Best regards
Andreas

February 2, 2024 at 8:42 am #15258150

T4ng

Hi,
Thanks for this offer, and sorry for saying this, but I expected more of an out of the box solution, rather than relying on an umpteenth plugin for this.
Instead, can I take care of this through any bulk edit plugin? Such as WP All Import/Export, which I already have?

By the way, I'm aware of that tickbox, unfortunately, it's really easy to forget ticking it.

Thanks anyway

February 2, 2024 at 2:26 pm #15259714

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

WPML will always expect that a translation needs an update, if the original content has been edited (unless you click the suggested checkbox when making a minor edit).

There is not any option inside WPML to bulk update translations unless you use the mode that automatically translates your content in the background while using credits for automatic translation.

There is a way to achieve this programmatically, if you add this snippet to the functions.php file of your theme, save the file and afterward remove the snippet again:

if you would like to give this a try PLEASE MAKE A BACKUP OF YOUR SITE AND DATABASE!

// Add a function to the admin_init hook
add_action( 'admin_init', 'save_all_posts_on_refresh' );

// Define the function to save all posts on refresh
function save_all_posts_on_refresh() {
  // Check if the current page is the posts page
  global $pagenow;
  if ( $pagenow == 'edit.php' ) {
    // Get all the posts
    $args = array(
      'post_type' => array('page', 'post'),
      'numberposts' => -1
    );
    $all_posts = get_posts( $args );
    // Loop through all the posts and update them
    foreach ( $all_posts as $single_post ) {
      wp_update_post( $single_post );
    }
  }
}

This code will save all your posts and pages once you refresh the browser while being on your pages or posts list /wp-admin/edit.php and will also mark your manual translation as completed.

Please remove the code from the functions.php file after you have used it.

It would be easier and maybe even more secure to use a bulk edit plugin.

WP All Import neither is a solution, as it needs an import of original products as a reference to connect the imported translations.

February 6, 2024 at 9:58 am #15270227

T4ng

ok understood. Thanks