WPML
Stato
Risolto
Segnalato per
WPML Media Translation 2.7.3
Risolto in
WPML 4.7.2
Tag dell’argomento
Bug

Panoramica del problema

La traduzione delle immagini tramite WPML Media Translation potrebbe non funzionare come previsto per le immagini inserite nella breve descrizione di un prodotto WooCommerce. Potresti notare che, nonostante la traduzione dell’immagine, questa non appare nella versione tradotta della breve descrizione del prodotto.

Soluzione alternativa

Assicurati di avere un backup completo del tuo sito prima di procedere.


  • Apri il file …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-post-images-translation.php.

  • Cerca la riga 146.

  • Sostituisci:
    			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' )
    				);
    			}
  • con:
    				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' )
    					);
    				}

Tutti i problemi noti →