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-
AuthorPosts
-
January 11, 2017 at 11:36 pm #341211
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-44802I 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,
MarcJanuary 11, 2017 at 11:38 pm #341213This reply has been marked as private.January 12, 2017 at 12:06 am #341233I 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.January 12, 2017 at 8:52 pm #341709I 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.
January 12, 2017 at 9:07 pm #341714OK 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.
January 13, 2017 at 11:28 am #341998Glad 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
January 14, 2017 at 1:02 am #342332Documentation added now at https://wpgeodirectory.com/docs/translating-custom-post-types/
Please let me know if there are any suggestions for improvement.
January 14, 2017 at 8:15 am #342453Hi 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 problemBest,
MarcJanuary 14, 2017 at 8:48 am #342464“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.
January 14, 2017 at 12:42 pm #342555😉
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.
January 15, 2017 at 10:13 pm #343192Hi 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 slugsTranslating the CPT slug that appear in WPML String Translation under the “WordPress” Domain fixes all 4 issues.
Cheers,
Marc -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket