Multi-lingual Custom Post Type Slugs
This topic contains 6 replies, has 2 voices, and was last updated by kairei 7 years, 8 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: custom post type, localization, slug, translation
-
AuthorPosts
-
March 24, 2017 at 9:09 pm #369687
When creating a custom post type, it says:
The listing slug name ( max. 20 characters ). Alphanumeric lower-case characters and underscores and hyphen(-) only. Min 2 letters.
Can I not have slugs in other languages? E.g. I have a Japanese site with a セラピスト custom post type and I want the slug to be セラピスト. The URL for a custom post type detail page is currently:
https://マッサージ.com/therapists/日本/東京都/東京/指圧/私のテスト/
I use an IDN domain and translated the country so everything looks great except the custom post type slug is in English. So far it seems you’ve got everything covered on localization except for this… is it not possible? I saw someone else in an old support thread asking for support for dashes in slugs and it was added. Could this be added too?
If this isn’t possible and cannot be added, is there a way to hide the /therapists/ part altogether?
This is really important for my SEO efforts so hopefully there is a good solution.
March 24, 2017 at 9:30 pm #369693It seems like your permalinks options give me the option to show/hide everything in the URL above except the CPT slug. Now I’ve got it down to just this:
/therapists/私のテスト/
which is exactly what I wanted, just the CPT type and the title, if only I could translate that slug part. Hopefully I’m just missing something.
March 24, 2017 at 11:55 pm #369711Please review
https://wpgeodirectory.com/docs/translating-custom-post-types/
and
https://wpgeodirectory.com/docs/translating-custom-fields/Let us know how you went.
Thanks
March 25, 2017 at 6:40 pm #369866So, I just enabled WPML’s string management and at the top of the “WPML > String Translation” page I searched for my custom type “Therapists” and got two results with Domain “geodirectory.” These are showing without having run the GD tool.
First was the string “Therapists” with no context. When translated, this seemed to change the text in some places but not all. E.g. the breadcrumbs now had the translated term but the top menu didn’t (although I think I’ve seen that is set separately in the custom type definition). So, it seems this is all good.
Second was the string “therapists” with the context “URL slug.” That also seemed to partially work, meaning when I’m on a map page, the link to the listing detail page now uses the translated slug. However, when I actually try to go to that page, it fails due to being “redirected to many times.” Now it appears this ticket may overlapping with my other ticket about the too many redirects thing:
https://wpgeodirectory.com/support/topic/wpml-compatibility-2/
When I do run the GD tool and try to go through all the instructions you referenced, I find that the slug “therapists” isn’t in the db-language.php file so when I try to follow through with the PO Edit stuff, that string just isn’t there so now I’m thoroughly confused. 🙁 Sorry if I’m missing something obvious.
Btw, not sure this matters but my site’s default language as set by WPML is Japanese, not English, since I want a Japanese first experience (the English version will be secondary).
March 25, 2017 at 8:26 pm #369880After some more messing around (including running the GD tool) I now magically have a “URL slug: therapists” option showing up in string translation with domain “WordPress” but it doesn’t seem to help anything.
March 25, 2017 at 11:53 pm #369895Let’s stick to the one topic only at https://wpgeodirectory.com/support/topic/wpml-compatibility-2/ to make life easier for Kiran. Thanks
March 26, 2017 at 1:25 am #369910Yup, sorry – when I started I thought they were separate but moving just to that one makes sense given all the info we have now. Thanks!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket