Urgent: all listings go to a 404 error

This topic contains 10 replies, has 3 voices, and was last updated by  Marc Mathys 8 years, 3 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #341211

    Marc Mathys
    Expired Member
    Post count: 216

    Hi,

    I just took 2 steps:

    1. Renamed “Places” into “Stores”, which also changes the slug.
    2. In WMPL, I translated the slug accorting to the information found here: https://wpgeodirectory.com/support/topic/translating-main-category-post-type-in-the-url/#post-44802

    I have the “Add full location info with country, region and city slug in listing urls” set, so I expect to see urls with /stores/country/region/city/name. Instead all my listings now have an URL /stores/name or /magasins/name and they all point to a 404 error.

    Thanks,
    Marc

    #341213

    Marc Mathys
    Expired Member
    Post count: 216
    This reply has been marked as private.
    #341233

    Marc Mathys
    Expired Member
    Post count: 216

    I undid WPML slug translation and the 404 are gone for now.
    Only issue is that it says “Store” all over the French site.
    The “urgent” in the title can be downgraded, sorry.

    #341709

    Marc Mathys
    Expired Member
    Post count: 216

    I found the issue causing the 404 error:

    Once Places gets renamed Stores in the CPT plugin and the slug changed to “stores”, it doesn’t automatically rename the “Listing url prefix” setting on the Permalinks page of the main GD plugin. This needs to be manually edited to match the slug name of the new Places (stores in my case).

    Then translating the slug with WPML works, but doing so removes the entire /country/region/city/ off the URL even if settings are correct on the Permalinks page.

    #341714

    Marc Mathys
    Expired Member
    Post count: 216

    OK I found the solution to translating the CPT slugs without losing the entire location in the URL:

    The slugs need to be translated in 2 places:
    – once for CPT, like described here: https://wpgeodirectory.com/support/topic/translating-main-category-post-type-in-the-url/#post-44802
    – and multiple times in the WPML String Translation tool. I searched for my slug with exact match and translated 3 entries:
    – 2 in WordPress domain named “URL slug: stores” and “URL slug: gd_place”
    – 1 in geodirectroy domain with the Context “URL slug”

    And now it works. Case solved, but painful process when undocumented.

    #341998

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Glad you solved it, WPML can add a extra layer of complexity to things that have been setup to be translatable to one different language.

    Stiofan

    #342332

    Guust
    Moderator
    Post count: 29970

    Documentation added now at https://wpgeodirectory.com/docs/translating-custom-post-types/

    Please let me know if there are any suggestions for improvement.

    #342453

    Marc Mathys
    Expired Member
    Post count: 216

    Hi Guust,

    Thanks, great initiative. I think there might be an important point missing from the documentation: doing only the translation in WPML Translation Manager for CPT did NOT work for me (if I wanted to keep the location in the URL). I had to also go into WPML String Translation and translate the multiple instances of the slugs.

    If I remember correctly:
    – WPML Translation Manager -> translated the French slug of the listing, but removed the location from the URL (only in French, English was still fine). So it went from /fr/cpt_slug/country/region/city/listing to /fr/cpt_slug/listing
    – WPML String Translation -> translating all instances of slugs as well fixed that problem

    Best,
    Marc

    #342464

    Guust
    Moderator
    Post count: 29970

    “If I remember correctly:” Great comment 🙂

    “If I remember correctly”, I fixed that with re-saving WP permalinks. I wrote the doc as I was changing the names and slugs on my test site, and “If I remember correctly” I did not have any other issues.

    You also renamed Places to Strres, so that might have contributed.

    #342555

    Marc Mathys
    Expired Member
    Post count: 216

    😉

    I do remember trying to re-save permalinks and it didn’t work. And you’re right, I did have 2 issues at once, renaming places and not manually matching the slug from CPT with the GD prefix was what caused the 404.

    #343192

    Marc Mathys
    Expired Member
    Post count: 216

    Hi Guust,

    As I moved from test site to staging site, I had to go through it again with new CPT. If slugs are only translated like you documented, there are definitely major issues left, even after resaving permalinks. For example:

    1. the links on the categories widget sill have the English slug when the site is in another language
    2. going on a category’s page and switching language with the WPML language selector still goes to the wrong language CPT slug
    3. going on a listing in a foreign language and clicking on a category link, will have the wrong language in slug and yield to a 404
    4. going on a listing’s page in English and switching language with the WPML language selector still go to the right language CPT slug, but the URL will miss all the location slugs

    Translating the CPT slug that appear in WPML String Translation under the “WordPress” Domain fixes all 4 issues.

    Cheers,
    Marc

Viewing 11 posts - 1 through 11 (of 11 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