WPML
Trạng thái
Đã được giải quyết bởi nhà phát triển
Plugin/giao diện liên quan
Houzez
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Khi sử dụng giao diện Houzez, các hình ảnh phương tiện của bất động sản được thêm thông qua phần Phương tiện không hiển thị văn bản ALT đã dịch trên các trang bất động sản đã dịch.

Giải pháp tạm thời

Vui lòng đảm bảo tạo bản sao lưu toàn bộ trang web của bạn trước khi tiếp tục.


  • Mở tệp functions.php trong giao diện của bạn.

  • Thêm đoạn mã sau:
    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;
    }

Tất cả các lỗi đã ghi nhận →