Skip Navigation


Reported for: 4.5.11 4.5.11

Topic Tags: Bug

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.



Please make a full backup of your site before proceeding:

  1. Locate and edit the following file: wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-image-translate.php
  2. 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 ) {
  3. Add the following code right after  if ( $attachment_translation ) { :
    do_action( 'wpml_switch_language', $language );
  4. Save the changes.
  5. 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.

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>