- ステータス
- 解決済み
- 解決されたバージョン
- 2.3.0
問題の概要
以下の致命的なエラーが発生する場合があります。
- Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Argument ID must be numeric and greater than 0’
この問題は、WPML Media Translationプラグインに関連しています。これは、添付ファイルデータを持たず、画像への絶対リンクのみとなっている画像がある場合に発生します。
回避策
この問題は将来のリリースで修正される予定です。一時的な回避策として、以下の手順を実行してください。
- ../wpml-media-translation/classes/images-translation/フォルダーにあるclass-wpml-media-image-translate.phpファイルを編集します。
- 以下のコードを使用して、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;
};
}