Skip Navigation

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 3 replies, has 2 voices.

Last updated by Prosenjit Barman 1 year, 7 months ago.

Assisted by: Prosenjit Barman.

Author Posts
November 1, 2023 at 9:37 am #14706161

andiG

Dear Support

We use ACF Pro to setup some CPTs like this one here (some ACF php code to demonstrate the case/code from ACF)
------
'has_archive' => 'dp-comments-branchendaten',
'rewrite' => array(
'slug' => 'dp-item-branchendaten',
'feeds' => false,
),
etc
------
The CPT archive page is correctly shown at domain.com/dp-comments-branchendaten and posts at domain.com/dp-item-branchendaten/item-1

We have another language setup with WPML, and we only see an option in WPML settings to translate "dp-item-branchendaten" to other languages, but not the slug for "dp-comments-branchendaten" itself, that is used as the post type archive page slug.

We expect in French:

CPT archive page: domain.com/fr/dp-comments-branchendaten-french

How/where can this be done? Is there a documentation for this?

Thanks for helping out!
Best, Andi

November 1, 2023 at 11:47 am #14706955

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Andi,
Thanks for contacting WPML Support.

I understand the issue you're having and will try my best to assist you in this matter.

Since you're using the ACF PRO plugin, it's important to also install the "Advanced Custom Fields Multilingual" plugin on your site to ensure ACF functions correctly with the WPML plugin. Please check the documentation below for more information.

- https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/

You can install and activate the plugin from Plugins > Add New > Commercial tab.

To enable the translation of the Slug for the Custom Post Type (CPT) that's registered programmatically, the 'has_archive' value needs to be set to 'true'. By defining a specific string as a value, you're defining the same slug for default and secondary language.

Please refer to the documentation provided below for guidance on how to make the slug of a programmatically created CPT translatable.

- https://wpml.org/documentation/support/translating-slugs-for-custom-post-type-archives/#setting-a-translatable-slug

Please make the adjustments accordingly and I hope the issue will be solved after that.

Let me know if that helps or if you need further assistance. I will be happy to help.

Best regards,
Prosenjit

November 1, 2023 at 3:50 pm #14708985

andiG

Hello Prosenjit

Do you agree, that your extra Plugin ACFML is not doing anything regarding the new features Custom Post Types in ACF? To me, it looks like this plugin handles only field groups.

Anyway, is it correct, that if a CPT is setup with
---
has_archive = true
---
WPML can translate this on the Settings page (tested an works well). But not if we use a custom slug like this example
---
has_archive = 'slug-to-archive-page'
---
Is this statement correct?
Thanks.
Best Regards
Andi

November 2, 2023 at 6:27 am #14712561

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Andi,

The ACFML plugin is essential for managing the translation of fields within a field group. This is indeed not required if the custom post type is created using ACF, as WPML itself can handle post-type translation.

The statement is totally correct! Setting the 'has_archive' value to 'true' makes the slug translatable. Conversely, if you define it as a string, it becomes the fixed slug for both the default and translated post type, which cannot be translated.

Since setting 'has_archive' to 'true' was successful for you, please proceed with this method to translate the slug.

I hope you can understand. Please let me know if you need further assistance or clarification in this matter. I will be happy to help.

Best regards,
Prosenjit