WPML
ステータス
解決済み
報告対象
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' )
    					);
    				}

すべての既知の問題 →