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).
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.