Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is unable to translate a PDF file assigned to a custom 'project' post using an ACF field of type 'file'. The field is set to 'Translate' in WPML settings, but it does not appear in the translation screen, and the same PDF file as the PL version is automatically used for the EN version.
Solution:
We recommended inserting the following code into the theme's functions.php file to allow translating numeric values, which include the PDF file ID:

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
    
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
    
    if ( is_numeric( $data ) ) {
        return true;
    }
    
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

After adding this code, make a minor change to the page title and attempt to translate the PDF file ID, which should now be visible in the media library. Additionally, we suggested using the Media Translation interface for a more user-friendly approach to translating the PDF file.

If this solution does not resolve your issue or seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 0 voices.

Last updated by romanL-25 5 days, 9 hours ago.

Assisted by: Kor.

Author Posts
November 26, 2025 at 9:11 am #17610543

romanL-25

Hi Kor.
Could you take a look at another issue? I'm posting in this same thread so you can immediately use the granted WordPress access. I'm using an ACF field of type "file" to assign a PDF file to a custom "project" post. I want to be able to assign a different PDF file to the PL version and a different one to the EN version. So, I set the field in "WPML->Settings->Custom Fields Translation" to be of type "Translate." However, it doesn't appear in the translation screen, and the same PDF file as the PL version is automatically transferred to the EN version. See these posts for examples:
PL: hidden link
EN: hidden link

I've attached some screenshots.

November 26, 2025 at 9:16 am #17610565

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply. Based on the screenshot you shared, it looks like you're translating the PDF id.

You need to use the code below in your theme's functions.php file

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
   
    if ( 'base64' === $job_translate['field_format'] ) {
        $data = base64_decode( $data );
    }
   
    if ( is_numeric( $data ) ) {
        return true;
    }
   
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

By default, numeric value is excluded from the WPML translation editor, so we need to use the code above to allow translation.

Once you've inserted the code, make a minor change to the page title. Then, translate the PDF file id. This PDF id should be visible in the media library.

November 27, 2025 at 12:07 pm #17614769

romanL-25

I added this piece of code, but unfortunately I still can't translate the file_id field. For example, I enabled translation of the “Description” ACF text field and it appears on the translation screen. The “PDF File” field is missing. I am attaching a screenshot.

I debugged this filter by adding the following line of code, and this filter is not triggered at any stage:

file_put_contents('wpml-test.log', date('Y-m-d H:i:s') . ' - ' . print_r($job_translate, true) . "<br>\n", FILE_APPEND);

screen-acf-5.png
November 27, 2025 at 1:54 pm #17615289

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply. I've checked, and I can see the PDF media ID showing up in the Advanced Translation Editor as shown in the attached screenshot. You can find the media ID in the media library, as shown in the attached screenshot. Could you try translating that ID and let me know if it works?

Screenshot_90.png
Screenshot_91.png
December 4, 2025 at 12:57 pm #17634309

romanL-25

Okay, the “PDF file” field appears, but I have to enter the ID in the search field, which is very confusing. You didn't mention earlier that I have to enter the ID in the search field on the translation screen. This will be very inconvenient for the average user. Besides, when I remove the “wpml_tm_job_field_is_translatable” filter, the “PDF file” field also appears after typing in the search bar, so I don't understand what the role of this code is.

December 4, 2025 at 1:45 pm #17634588

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply. That's one of the ways. Yes, it's not user-friendly, so I suggest that you use the Media translation to translate the PDF file as shown here. hidden link

Could you try and let me know if this works for you?

Screenshot_11.png
December 4, 2025 at 9:59 pm #17636282

romanL-25

Indeed, translating via “WPML->Media Translation” is much easier. I didn't notice that option. We can consider this topic closed. Thank you 🙂