WPML
Trạng thái
Đã giải quyết
Được báo cáo cho
WPML Media Translation 2.7.3
Đã giải quyết trong
WPML 4.7.2
Thẻ chủ đề
Bug

Tổng quan về lỗi

Việc dịch hình ảnh bằng WPML Media Translation có thể không hoạt động như mong đợi đối với các hình ảnh được chèn vào phần miêu tả ngắn của sản phẩm WooCommerce. Bạn có thể thấy rằng, mặc dù đã dịch hình ảnh, nó không xuất hiện trong bản dịch phần miêu tả ngắn của sản phẩm.

Giải pháp tạm thời

Vui lòng đảm bảo bạn có bản sao lưu đầy đủ cho trang web của bạn trước khi tiếp tục.


  • Mở tệp …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php.

  • Tìm dòng 146.

  • Thay thế:
    			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' )
    				);
    			}
  • bằng:
    				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' )
    					);
    				}

Tất cả các lỗi đã ghi nhận →