WPML
Stato
Risolto
Risolto in
2.3.0

Panoramica del problema

A volte, potresti riscontrare il seguente errore fatale:

  • Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Argument ID must be numeric and greater than 0’

Questo problema è legato al plugin WPML Media Translation. Si verifica se hai un’immagine che non ha dati dell’allegato ed è solo un link assoluto all’immagine.

Soluzione alternativa

Questo problema verrà risolto in una versione futura. Come soluzione alternativa temporanea, puoi seguire questi passaggi.


  1. Modifica il file class-wpml-media-image-translate.php che si trova nella cartella ../wpml-media-translation/classes/images-translation/.

  2. Usa il seguente codice per sostituire la funzione get_translated_image_by_url.
public function get_translated_image_by_url( $img_src, $source_language, $target_language ){

$attachment_id = $this->get_attachment_image_from_guid($img_src, $source_language);
if (!$attachment_id) {
$attachment_id = $this->get_attachment_image_from_meta($img_src, $source_language);
}
if ($attachment_id){
$size = $this->get_image_size_from_url($img_src, $attachment_id);

return $this->get_translated_image($attachment_id, $target_language, $size);
} else {
return $img_src;
};
}

Tutti i problemi noti →