- 状态
- 已解决
- 报告针对
- WPML Media Translation 2.7.3
- 解决于
- WPML 4.7.2
- 主题标签
- Bug
问题概述
对于插入到 WooCommerce 产品简短说明中的图像,使用WPML Media Translation进行的图像翻译可能无法按预期工作。您可能会发现,尽管翻译了图像,但它并未出现在产品简短说明的翻译版本中。
临时解决方法
在继续操作之前,请确保对您的站点进行完整备份。
- 打开 …/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' ) ); }