Skip Navigation

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

Problem:
The client is experiencing an issue where the titles and excerpts of custom post types are not translated on the main page, despite appearing translated in the Advanced Translation Editor (ATE). The relationship field was initially set to 'copy' and then changed to 'copy once', but the translations still did not display correctly.
Solution:
We recommend changing the setting of the relationship field to 'Copy Once' and manually updating the translation page using the WordPress editor. This adjustment should ensure that the relationship translations display correctly on the frontend. Please confirm if this resolves the issue on your end.
For further guidance, refer to our documentation on setting translation preferences for ACF fields: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/setting-the-translation-preferences-for-acf-fields-created-using-php-code/
and using different translation editors: https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

If this solution does not apply or is 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 issue persists, please open a new support ticket for further assistance.

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.

Tagged: 

This topic contains 12 replies, has 3 voices.

Last updated by Long Nguyen 12 months ago.

Assisted by: Long Nguyen.

Author Posts
June 21, 2024 at 10:57 am #15774166

sophiaB-2

Background of the issue:
I have a relationship field where you can choose 'posts' (custom post type). The page gets translated and the individual custom post types are translated, but the pulled in cpts (title and excerpt). I can see the title/excerpt in the ATE and everything is translated but on the main page where I pull in each cpt, it is not translated. I did follow the rules for relationship and set this to 'copy'. I originally had it set to 'copy once' but I changed this and resaved. I then resaved the post and the page and re-saved both translations. I also tried adding a test word at the end of the excerpt, saving and resaving the translation. Nothing worked.

Symptoms:
The excerpts of custom post types are not translated on the main page, even though they appear translated in the ATE.

Questions:
Why are the titles and excerpts of custom post types not showing as translated on the main page?
Is there a specific setting in WPML that I might be missing to ensure excerpts are translated correctly?

June 21, 2024 at 11:29 am #15774388

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

this is the ticket.

Please test the suggestion with default WP theme and only WPML plugins and ACF and let us know how it goes.

Regards,
Drazen

June 21, 2024 at 12:17 pm #15774867

sophiaB-2

I created the staging site, but I really don't understand how to show ACF fields on a default theme. How can I display ACF fields without writing the code to do so?

I did test the same type of relationship block that pulls in posts instead of custom post type and that translates properly. I also deactivated all plugins except WPML and ACF.

This was the explanation: To test if same issue happens when using WP default theme and only ACF and WPML. So you create same fields under ACF, add them to your page and select some other translated CPT, translate page and save. Check translated page and see if in field the translated CPT is connected.

The part I don't understand is "Check translated page and see if in field the translated CPT is connected." What am I looking for here? The page is blank since I haven't written the code into the default theme to display the ACF fields. Are you checking the database to see if the field is translated? I really don't understand and could use a better explanation.

Please provide the private form for me to upload the staging site credentials.

Thank you.

June 21, 2024 at 1:38 pm #15775692

sophiaB-2

For what it's worth, I checked both the english and german pages in the database and for the relationship field they both show the same posts (cpts) being pulled in.

English page ID 3789:
a:3:{i:0;s:4:"3790";i:1;s:4:"3797";i:2;s:4:"3798";}
German page ID 4096:
a:3:{i:0;s:4:"3790";i:1;s:4:"3797";i:2;s:4:"3798";}

I am not sure exactly how this works, but I would think that the german page should show the German cpt IDs.

I was mistaken earlier about this working for posts. It doesn't work in my relationship fields for posts or custom post types. I have the translations set to copy for all relationship fields.

Also, if the only thing I include on the page is the relationship field, the translated page is blank. It seems like it's not recognizing the relationship field at all and I have to add another block of some sort to get the page to translate at all.

I would appreciate any help you can provide.

Thanks.

June 21, 2024 at 2:08 pm #15775882

sophiaB-2

Sorry, one last bit of info. The link in the post is correct, so it leads correctly to the german post. The category is also correctly displayed in German. So, it's just the excerpt and title.

June 26, 2024 at 6:55 am #15830327

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Sophia,

Thank you for contacting WPML support, I’m happy to help you with this issue.

Please share some screenshots of the issue, the page where I can see that. Then I would like to request temporary access (wp-admin and FTP) to your staging site to take a better look at the issue. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌

Looking forward to your reply.
Thanks

June 26, 2024 at 10:08 am #15832372

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

There is an issue with the Relationship field when using preference "Copy" and translating the page with Advanced Translation Editor.
If I change the preference to "Copy Once"
'wpml_cf_preferences' => 3
and re-update the translation page manually with WordPress editor, the translation relationship is displayed correctly in the frontend.

Can you please confirm it works on your end?

Refer documentation
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/setting-the-translation-preferences-for-acf-fields-created-using-php-code/
https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

Looking forward to your reply.
Thanks

Lehrpläne - Migration Matters 2024-06-26 17-08-15.jpg
June 26, 2024 at 10:19 am #15832498

sophiaB-2

No, that isn't working for me. The weird thing is that I already had these set as 'wpml_cf_preferences' => 3 because that was the recommendation I had received for these fields in past builds. I changed it to 1 to try to fix this issue. And in fact, several relationship fields (on Our Team, for example) were still set to copy once. I can see that you managed this for Lesson Plans on the staging site. I tried re-saving the page in English, then clicking through to the translation and re-completing the translation. This didn't work.

I am also noticing that the links to these pages are going to the EN page. I had also set these to copy, should these be copy once as well?

June 26, 2024 at 10:25 am #15832548

sophiaB-2

Sorry, I misunderstood what you meant by manually translating. I did this now (using the WordPress editor) and it works.

Can you just let me know about the links?

June 27, 2024 at 1:48 am #15838415

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I am also noticing that the links to these pages are going to the EN page. I had also set these to copy, should these be copy once as well?

Do you mean the button link on the page below?
EN: hidden link
DE: hidden link

I see the field preference is set to "Translate"

array(
    'key'                 => 'field_' . $prefix . '_' . 'button',
    'label'               => __( 'Button', 'migrationmatters' ),
    'name'                => 'link',
    'type'                => 'link',
    'wpml_cf_preferences' => 2,
    'return_format'       => 'array',
),

then you need to translate the URL manually in the Advanced Translation Editor. If you want to adjust the internal automatically, please set the preference to "Copy" ('wpml_cf_preferences' => 1)

Looking forward to your reply.
Thanks

Screenshot 2024-06-27 at 08.44.49 2024-06-27 08-45-00.png
June 27, 2024 at 9:18 am #15842323

sophiaB-2

I would like these to translate automatically but I did try changing preference to 1 and I could not get that to change. I also went into settings and clicked the button in the "Translate Link Targets" section to scan and translate links. I also resaved the pages with links. What do I have to do after changing this setting to "1" to get this to work automatically.

June 27, 2024 at 9:33 am #15842410
sophiaB-2

UPDATE: If I change 'wpml_cf_preferences' to "1" the button text gets copied so it is always in English. I want the button text to be translatable, but ideally the link itself is automatically adjusted to the translated version of the page. I thought I was able to do this in other sites I've built. Is this possible? If so, how do I do this?

New threads created by Long Nguyen and linked to this one are listed below:

https://wpml.org/forums/topic/the-button-text-gets-copied-so-it-is-always-in-english/

June 28, 2024 at 6:45 am #15849678

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

The issue with the button link is a separate one, I will split this ticket into a new ticket for better handling.

Thanks.