Open
Reported for: 4.5.11 4.5.11
Overview of the issue
You will notice that the main URL of one of your languages is also used on the images of your translated languages.
The images will still display correctly throughout the languages.
Still, you may encounter CORS issues in some cases, which will translate into the image not showing.
This problem will only happen if you use different domains per language.
Workaround
Please make a full backup of your site before proceeding:
- Locate and edit the following file: wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php
- Locate this code:
public function get_translated_image( $attachment_id, $language, $size = null ) { $image_url = ''; $attachment = new WPML_Post_Element( $attachment_id, $this->sitepress ); $attachment_translation = $attachment->get_translation( $language ); if ( $attachment_translation ) {
- Add the following code right after if ( $attachment_translation ) { :
do_action( 'wpml_switch_language', $language );
- Save the changes.
- Please follow one of the following methods:
Method 1:
- Install and activate WPML Media translation
- Go to WPML > Media Translation
- Locate one of the problematic images
- edit one of the translations
- Make a small edit to the translated image’s description
- Save the changes
Method 2:
- Go to WPML > Settings
- Scroll down until the section “Translate Link Target”
- Click the “Apply” Button
- Wait until the process finishes.