This thread is resolved. Here is a description of the problem and solution.
Problem: You are trying to translate the slug for a custom post type (CPT) called 'book'. The slug should be 'book' for the single template and 'books' for the archive template. You have followed the instructions from the WPML documentation but cannot find the option in WPML settings to translate the archive slug, as the settings only provide a field for the singular slug. Solution: We currently do not support the direct translation of archive slugs for custom post types due to technical limitations. However, we recommend a workaround which you can find detailed in our forum: https://wpml.org/forums/topic/custom-post-type-via-acf-archive-translation/#post-16830228.
If this solution does not apply to your case, or if it seems outdated, please open a new support ticket. We also 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. For further assistance, you can contact us directly through our support forum.
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.
Symptoms:
I can't find the place in the WPML settings to translate the archive slug. The settings only have a field for the singular slug, but there is no field for the archive slug, which is different from the singular.
Questions:
Where can I translate the archive slug for a custom post type in WPML?
Hey Bigul. Sorry about the double ticket. I was opening the ticket and then at the end I clicked on the wrong button and there was no way for me to find the ticket again. You can close the other one and we continue here.
Thank you for the updates. No problems. I have closed the duplicate ticket now. Are managing the CPT by customized code? If so, please share the code you are using for creating the Custom Post Type. It will help us to cross-check it further.
Thank you for the details. Please fill in the private details fields after a full site backup{mandatory}. I would like to access the admin area of your site to check further. Refer to the following links for more details about our private information-sharing policies.
Hey Bigul. Thank you for your reply but I don't think we understand each other.
Our clients wants the singular template to have the slug book and the archive template to have the slug books. As you can see in my plugin this functionality works as expected. This is the archive link (hidden link) and this is the singular link (hidden link).
I hope that we've established that this functionality which we require is part of the WordPress API. So my question is can WPML translate those slugs seeing as this is the functionality that WordPress has built in the custom post API?
I hope I've explained my question if not let me know and I can go in more detail.
Thank you for the detailed feedback. I have consulted about this with our team.
WordPress allows us to set a specific archive slug for custom post types when you register them manually. But as of now, we can only translate the Post Type slug.
The examples shared in the doc like the following and we have requested *do not use the gettext functions for this parameter*.
English (default language): hidden link;
Spanish (second language): hidden link;
For the post type created with the archive slug *books*, the easiest approach would be to set has_archive => true and set the post type slug as *books*. This would allow the slug to be translated automatically across languages. In most cases, this method works well and aligns with how WordPress supports slug translation officially.
However, since you’re specifying the archive slug as 'books' instead of the default, it may require custom coding to achieve full functionality across languages.
Thank you for your kind understanding. Please let us know if you would like further assistance with this setup.
Hey Bigul. Thank you for your reply and help with this.
As for what you refer as "default" I wouldn't agree with that. There is no "default" in that sense, there is only what the WordPress API for registering custom pst type supports and the API has that option and that option works by itself. The issue is that WPML doesn't have support for that option. I presume there are no plans to implement that feature in WPML any time soon?