Overview of the Issue
The translation of images using WPML Media Translation may not function as expected for images inserted into the short description of a WooCommerce product. You may observe that, despite translating the image, it does not appear in the translated version of the product’s short description.
Workaround
This issue is fixed in WPML 4.7.2. Updating solves it on your site, so you only need this workaround if you can’t update yet.
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php file.
- Look for line 146.
- Replace:
if ( $post_content_filtered !== $post->post_content ) { $this->wpdb->update( $this->wpdb->posts, array( 'post_content' => $post_content_filtered ), array( 'ID' => $post->ID ), array( '%s' ), array( '%d' ) ); } - with:
if ( $post_content_filtered !== $post->post_content ) { $this->wpdb->update( $this->wpdb->posts, array( 'post_content' => $post_content_filtered ), array( 'ID' => $post->ID ), array( '%s' ), array( '%d' ) ); } $post_excerpt_filtered = $this->images_updater->replace_images_with_translations( $post->post_excerpt, $post_element->get_language_code(), $post_element->get_source_language_code() ); if ( $post_excerpt_filtered !== $post->post_excerpt ) { $this->wpdb->update( $this->wpdb->posts, array( 'post_excerpt' => $post_excerpt_filtered ), array( 'ID' => $post->ID ), array( '%s' ), array( '%d' ) ); }