WPML

問題の概要

WPML Media Translationを使用した画像の翻訳は、WooCommerce商品の短い説明に挿入された画像に対して期待通りに機能しない場合があります。画像を翻訳したにもかかわらず、商品の短い説明の翻訳版に画像が表示されないことがあります。

回避策

この問題はWPML 4.7.2で修正されました。 更新するとサイト上の問題は解決するため、この回避策が必要になるのは、まだ更新できない場合のみです。

続行する前に、サイトの完全なバックアップを必ず取得してください。

  • …/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' )
    	);
    }

すべての既知の問題

まだこの問題が発生しますか?

アップデートしても問題が解決しない場合は、サポートのご質問をお寄せください。一緒に調査いたします。