Multi-lingual Custom Post Type Slugs

This topic contains 6 replies, has 2 voices, and was last updated by  kairei 7 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #369687

    kairei
    Expired Member
    Post count: 78

    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.

    #369693

    kairei
    Expired Member
    Post count: 78

    It 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.

    #369711

    Guust
    Moderator
    Post count: 29970
    #369866

    kairei
    Expired Member
    Post count: 78

    So, 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).

    #369880

    kairei
    Expired Member
    Post count: 78

    After 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.

    #369895

    Guust
    Moderator
    Post count: 29970

    Let’s stick to the one topic only at https://wpgeodirectory.com/support/topic/wpml-compatibility-2/ to make life easier for Kiran. Thanks

    #369910

    kairei
    Expired Member
    Post count: 78

    Yup, 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!

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount