Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Andreas W. 8 months, 2 weeks ago.

Assisted by: Andreas W..

Author Posts
January 17, 2024 at 11:17 am #15194308

alexanderv-12

Hi there,

I hope you're having a good day!

I have the following issue:
On my site, I have content being created and translated in both of the two site languages. Meaning, I can have original posts in either one of the site languages, and content is then translated into the other language.

This leads to confusion, because neither on the frontend (while being logged in) nor in post or pages lists it is possible to see if a post is an original or a translation. (I know that one can tell by comparing post IDs, for example. But this is not really feasible for my users.)

But – and this is where it gets "dangerous" – both the Block Editor and the Elementor Editor are available for translated content. And as my users cannot tell if they are dealing with an original or translation, they often make changes via the aforementioned editors, instead of updating the translation through the WMPL translation editor. And, as you very well know, these changes get lost further down the road.

This is not the first time I encountered this issue, but usually it is clear which content is the original language and which the translation.

So, the main question is: Is there any way to disable the Block and Elementor Editors for translated content? If not: Is there a way to clearly mark posts/pages as translations in the backend?

I can't believe that this issue wouldn't concern many other WMPL users. I hope this is not a quick setting a just overlooked, or couldn't find when researching.

Looking forward to your suggestions!

Cheers

Alex

January 17, 2024 at 8:12 pm #15197058

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello,

Indeed, if the WPML Translation Editor is set as a translation method on content, then you will always translate from original content to second languages.

The option to switch between the translation method (WPML Translation Editor or WordPress Editor) is only visible on the original content.
For translations, the WordPress Editor's right sidebar will show a field "This is a translation of.." instead.

This means, that if you go to the pages list or directly on translated content on the WordPress Editor and click the translation icon, then it should usually redirect the user to the WordPress Editor of the original content.

Could you please test this behavior and let me know if this works as expected?

Best regards
Andreas

January 18, 2024 at 9:09 am #15198761

alexanderv-12

Hi Andreas,

thank you for your reply.

You said: If I were to "click the translation icon, then it should usually redirect the user to the WordPress Editor" – and I can confirm that this works as expected.

My question concerns a bordering, but slightly different issue: If the WPML Translation Editor is set as a translation method on content, why would it even be possible to open and edit *translated* pages/posts in the Block or Elementor Editors? This is exactly what I would like to prevent: I would like to prevent my users from (accidentally) editing translated content in the Block/Elementor Editors, and force them to use the WPML Translation Editor.

Is there a way to achieve this?

Cheers
Alex

January 18, 2024 at 2:47 pm #15200761

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Hello Alex,

We do show in such cases a popup dialog if a user is about to edit a translated post on the WordPress Editor. This dialog explains that you should not edit this content, as it is getting translated with the WPML Translation Editor.

You might need to train your translators, not to make such manual edits. I understand that due to the different source languages, this is kind of complicated. This is why we offer Translation Management.

Here you can create jobs and assign them to translators who then can only use the WPML Translation Editor for translations. You could also set a different user role for these translators so that they are unable to edit content directly.

Guide:
https://wpml.org/documentation/translating-your-contents/

Best regards
Andreas

January 18, 2024 at 5:26 pm #15201656

alexanderv-12

Hi Andreas,

thank you for your reply.

As far as I know, there is no such popup if a page is opened in Elementor Editor.

Also, at least in my use cases, the Translation Management has never been really helpful – due to the fact that it's almost always the same people that add and edit both the original content and the translations.

It's quite unfortunate that there is no other way to guide my clients.

Is this a place to make feature requests?

Feature request 1: Add option to prevent the editing of translated content in the Block Editor and Elementor Editor, if the WPML Translation Editor is set as "Translation Method"

Feature request 2: Add a notice/icon both in WP dashboard post lists and the WP admin bar on the frontend that indicates content is original or a translation.

Cheers

Alex

January 18, 2024 at 6:20 pm #15201804

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Thank you very much for your detailed message.

I will be forwarding both feature requests to our product manager and get in contact with you again, once I have received feedback.

January 19, 2024 at 1:50 am #15202653

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

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

Taking some internal research and overthinking your request, it seems not to be very effective to forward a feature request, as:

- it is kind of an edge case, with original content create in different languages
- we would need way more than one request of that kind, for our developers to consider the feature

For now, I would like to provide you with the following snippet, which I created and tested quickly. It will create a new admin column called WPML and print a text that should help your translators to identify if they are about to edit an original content or a translation.

add_filter('manage_page_posts_columns', 'my_custom_column', 10);
add_action('manage_page_posts_custom_column', 'add_my_custom_column', 10, 2);

function my_custom_column($defaults) {
  $defaults['wpml'] = 'WPML';
  return $defaults;
}

function add_my_custom_column($column_name, $post_id) {
  if ($column_name == 'wpml') {
    // Get the current post ID
	$post_id = get_the_ID();

	// Get the element type for the post
	$type = apply_filters('wpml_element_type', get_post_type($post_id));

	// Get the translation group ID (trid) of the post
	$trid = apply_filters('wpml_element_trid', false, $post_id, $type);

	// Get the translations of the post using the trid and the element type
	$translations = apply_filters('wpml_get_element_translations', array(), $trid, $type);

	 
	// Loop through the translations and check the original field
	foreach ($translations as $lang => $translation) {
		$lang_original = strtoupper($lang);
		$lang_of = strtoupper($translation->source_language_code);
	  // If the original field is 1, the content is an original content
	  if ($translation->original == 1) {
		echo "The content in $lang_original is an original content.\n";
	  }
	  // If the original field is 0, the content is a translation
	  else {
		echo "The content in $lang_original is a translation of the content in $lang_of.\n";
	  }
	}	  
  }
}

Place this hook at the bottom of your child theme's functions.php file.

You can see how it works on the following test site:
hidden link

Best regards
Andreas

The topic ‘[Closed] Restrict editor access (Elementor/Block Editor) for translated content’ is closed to new replies.