Home›Support›English Support›[Resolved] Url slug of original language custom post type sometimes is the translation
[Resolved] Url slug of original language custom post type sometimes is the translation
This thread is resolved. Here is a description of the problem and solution.
Problem: The client has a custom post type with translated slugs, but occasionally the archive page URL for the English site shows the Dutch slug instead of the English one. This issue is temporarily resolved by resetting the permalinks, but it can recur.
Solution: The problem occurs because, when registering the custom post types, the client uses a gettext call to define the post type slug. We recommend removing the gettext call from the rewrite slug in the custom post type registration and using a static text instead. Here's how to adjust the code:
After making this change, go to WPML > Settings > Post Types Translation to set the slug translations for your custom post type. If you prefer, you can also translate the slug using the String Translation feature, searching for the slug under the WordPress text domain.
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.
Then go to WPML > Settings > Post Types Translation and locate your custom post type, and you should be able to provide slug translations there (as in my screenshot from my test site, with a post type "Things").
Alternatively, you can translate the slug via String Translation (you should be able to find the slug under the WordPress text domain).