WPML
สถานะ
แก้ไขแล้วโดยผู้พัฒนา
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Houzez
แท็กหัวข้อ
Compatibility

ภาพรวมของปัญหา

เมื่อใช้ธีม Houzez รูปภาพสื่อของอสังหาริมทรัพย์ที่เพิ่มผ่านส่วนสื่อจะไม่แสดงข้อความ ALT ที่แปลแล้วบนหน้าอสังหาริมทรัพย์ที่แปลแล้ว

วิธีแก้ปัญหาชั่วคราว

โปรดตรวจสอบให้แน่ใจว่าได้ทำการสำรองข้อมูลไซต์ทั้งหมดของคุณก่อนดำเนินการต่อ


  • เปิดไฟล์ functions.php ของธีมของคุณ

  • เพิ่มข้อมูลโค้ดต่อไปนี้:
    add_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10, 4);
    
    function wpml_compsupp7300_filter_fave_property_images($null, $object_id, $meta_key, $single) {
        
    	// Target the specific meta key
        if ($meta_key !== 'fave_property_images') {
            return $null;
        }
    
        // Prevent recursion by temporarily removing the filter
        remove_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10);
    
        // Fetch the original meta value
        $images = get_post_meta($object_id, $meta_key, $single);
    
        // Re-add the filter
        add_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10, 4);
    
        // Check if we actually got an array
        if (is_array($images)) {
            foreach ($images as &$image_id) {
                // Apply the WPML filter to each item (image ID)
                $image_id = apply_filters('wpml_object_id', $image_id, 'attachment', true);
            }
        }
    
        return $images;
    }

ปัญหาที่ทราบแล้วทั้งหมด →