Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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

Last updated by Nohemi 3 weeks ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
November 12, 2019 at 11:56 am

Nohemi

I am trying to: set the same featured image on all duplicated translation of a post

Link to a page where the issue can be seen: hidden link

I expected to see: an image on the french post like the english post : hidden link

Instead, I got: no image

How i can sync featured image between english and (duplicated) french post when media are not translatable ? (I followed instructions here to make media no translatable : https://wpml.org/forums/topic/disabled-media-translation-in-wpml-4-0/page/2/#post-3011157)

Best regards

November 13, 2019 at 1:36 am #4935433

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for contacting WPML Support. Please, try the following:

1 - Set the 'media' post type as 'Translatable...' from your WordPress Dashboard > WPML > Settings > Post types translation settings.

2 - Make sure the 'WPML Media Translation' addon plugin is installed and activated in your WordPress Dashboard > Plugins settings.

3 - Now, in your WordPress Dashboard > WPML > Settings > Media Translation make sure the 'Translate existing media in all languages', 'Duplicate existing media for translated content' and 'Duplicate the featured images for translated content' are checked and click the 'start' button and wait for the whole process.

See: https://wpml.org/documentation/getting-started-guide/media-translation/

Please, let me know if it helps, have a nice day.

November 13, 2019 at 8:10 am #4936231

Nohemi

Hello Marcos,

I know I can translate media, but precisely i don't want to translate them. I don't want to manage three attachment by media. I want to all languages have exactly the same media library.

I would just like the behavior before media translation was merged into the WPML core. Read this topic https://wpml.org/forums/topic/disabled-media-translation-in-wpml-4-0/ to see why a disabled media translation can be useful.

To answer to this topic your team has made a patch to do this. Everything works well except when a post translation is duplicated.

Best Regards

November 14, 2019 at 7:03 pm #4949605

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I noticed this behavior in a test install as well, this is why I forwarded this ticket to our second level support. I will update you here as soon as I have some more details from them, have a nice day.

November 15, 2019 at 2:09 pm #4954667

Lauren
Supporter

Languages: English (English )

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

Hi there, Marcos is off for today. Our developers have replied with this: if you don’t want to use media translation, you need to set media to don’t translate for the attachments and remove all entries for attachments in icl_translations table.

Also you need to uncheck the default behaviour to make attachments available in second language and the settings displayed in https://wpml.org/documentation/getting-started-guide/media-translation/#media-translation-settings

Please let me (and Marcos) know if this resolves the issue for you.

November 15, 2019 at 3:03 pm #4955081

Nohemi

Thank you for your answer :

"you need to set media to don’t translate for the attachments" => already set
"remove all entries for attachments in icl_translations table" => done
"you need to uncheck the default behaviour ...." => impossible because when medias are not translated the checkboxes disappear (you can check on my site)

Deleting table items did not change anything.

November 18, 2019 at 5:26 pm #4967115

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates and sorry for the bit of waiting due the weekend. I've just forwarded your updates to our second level support team, I will update you here as soon as we have some more details. Have a nice day.

November 19, 2019 at 3:31 pm #4973931

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I got some more details from our second level support and here is how it behaves:

1 - When you set the media attachment post type as 'Not translatable' you are turning off all the WPML behavior regarding entries duplications (not file duplications), different media files for different languages and so on.

2 - You should see the same media files regardless the language, without any extra database tables, duplicated entries or so.

3 - The media files for the secondary languages such as the featured image for example should be set manually, it happens because it is the job of WPML media translation to copy the media files for the secondary languages, of course something not possible with not translatable media.

Hope it clarifies, have a nice day.

November 19, 2019 at 4:14 pm #4974183

Nohemi

Ok so if media translation is deactivated, translation duplication works perfectly except for featured image? So you confirm the feature has been removed because it worked before wpml 4.0 ?

Secondly, if i set the featured image manually to the second language (which is duplicated), I get the message :
"You are updating a duplicate post.
To not lose your changes, WPML will set this post to be translated independently."

If I click on cancel : the post is saved anyway and the featured image is set. So it works but it is a strange behavior.

November 21, 2019 at 1:57 am #4984937

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I performed some tests in a clean sandbox environment and in all my tests when media is set as 'Not Translatable' no media is copied to the secondary language.

Also, in the most recent versions of WPML when media is set as 'Not Translatable' you are unable to change the behavior of media files for duplicated content for example, while it will allow you to set a media file manually when you add a translation, it won't work properly for duplicated content since once you edit the duplicated content you will need to convert it to a independent translation.

That being said, in your particular case, the better choice will be to make the media (attachment) post type as 'Translatable - use translation if available or fallback to default language' this way you can have the same media file for all the languages be it a translation or duplication.

Hope it helps, have a nice day.

November 21, 2019 at 8:29 am #4985863

Nohemi

Hi,

Finally, i made a mu-plugin to set the same featured image on all translated posts (independant or duplicated)

If it is useful to someone :

function wpml_after_save_post( $post_id, $trid, $language_code, $source_language ) {
	global $sitepress;
	if ( isset( $sitepress ) && ! get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
		$trid         = $sitepress->get_element_trid( $post_id );
		$translations = $sitepress->get_element_translations( $trid );
		$thumbnail_id = get_post_thumbnail_id( $post_id );
		foreach ( $translations as $translation ) {
			if ( (int) $translation->element_id !== (int) $post_id ) {
				if ( $thumbnail_id ) {
					set_post_thumbnail( $translation->element_id, $thumbnail_id );
				} else {
					delete_post_thumbnail( $translation->element_id );
				}
			}
		}
	}
}

add_action( 'wpml_after_save_post',  'wpml_after_save_post', 10, 4 );

Thank you anyway for your help.