- Статус
- Решено
- Заявлено для
- WPML Media Translation 2.7.3
- Решено в
- WPML 4.7.2
- Теги темы
- Bug
Обзор проблемы
Перевод изображений с помощью WPML Media Translation может работать не так, как ожидается, для изображений, вставленных в краткое описание товара WooCommerce. Вы можете заметить, что, несмотря на перевод изображения, оно не отображается в переведенной версии краткого описания товара.
Обходное решение
Перед продолжением убедитесь, что у Вас есть полная резервная копия Вашего сайта.
- Откройте файл …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php.
- Найдите строку 146.
- Замените:
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' ) ); } - на:
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' ) ); }