WPML
الحالة
محلولة
تم حلها في
2.3.0

نظرة عامة على المشكلة

قد تواجه أحياناً الخطأ الفادح التالي:

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

تتعلق هذه المشكلة بإضافة WPML Media Translation. يحدث هذا إذا كانت لديك صورة ليس لها بيانات مرفق، وهي مجرد رابط مطلق للصورة.

حل بديل مؤقت

سيتم إصلاح هذه المشكلة في الإصدار المستقبلي. كحل بديل مؤقت، يمكنك اتباع الخطوات التالية.


  1. عدّل الملف class-wpml-media-image-translate.php الموجود في المجلد ../wpml-media-translation/classes/images-translation/.

  2. استخدم الكود التالي لاستبدال الدالة 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;
};
}

جميع المشاكل المعروفة →