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.
Author | Posts |
---|---|
November 29, 2023 at 8:08 pm #14956197 | |
jonathanF-3 |
Hi, I noticed that some urls have opposite language elements 'site.com/french-post-type/english-title/'. This is true for standard and custom posts. Exemple: We have a cpt 'produits' with a slug rewrite to 'etiquettes', translated to 'labels' in wpml. For a post named post-fr translated to post-en, we would get these urls: The 2 right ones: but also (all redirected to site.com/etiquettes/post-fr/): site.com/etiquettes/post-en/ Same for site.com/en/... redirected to site.com/en/labels/post-en/ I also noticed that in the header(on french website), under industries / last section "etiquettes", we get twice each post. One with the french title and the good url and one with the English title and this url: site.com/labels/french-title/. Still in the header, in 'CPT produits' i've made 2 testing posts: 'Test FR' translated to 'Test EN' and 'Test2 FR no translation'. And on standard post single page, in the last section 'Articles that might interest you', Can you help me fix this please? I've already made a copy of the website with all plugins deactivated except WPML's and ACF pro if you need it. |
December 1, 2023 at 2:31 pm #14973697 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Thanks for contacting WPML support. How are you translating the posts from French to English? Also, is this issue only happening on your custom post type? How was the CPT created? If you would like to share access to your test site, you can provide login details in the next reply which I have marked as private. |
December 5, 2023 at 7:36 pm #15002451 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
I just checked the site and I"m not seeing the CPTs listed twice under industries in the header, nor when I click through to view the page. Can you please send me the link to the page where you are seeing it as well as a screenshot? Same thing for the test posts. I'm not seeing them listed anywhere on the page. Please send URL and screenshot. As for the related articles showing the wrong language, how are you inserting the related articles on the bottom of the post page? Are you using a plugin, custom code, etc? |
December 5, 2023 at 8:57 pm #15002703 | |
jonathanF-3 |
Sorry i didnt mentioned that i made the test post on the staging site, my bad. hidden link. I can see it on homepage. On the english side the 2 first have the same url. /en/labels/flexible-labels/ On the french side the urls are slightly different, but redirect to same post. For the related articles, its custom code: <section id="others-news"> if ($arrNews) : = get_the_title($news->ID) ?>
Thank you! |
December 5, 2023 at 9:44 pm #15003003 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Thanks for clarifying where you are seeing this, and the screenshot. I looked at your menus, but I don't see Industries as part of the menu. How are you adding this content to the menu? As for the related links, custom code work is outside the scope of WPML Support, but here's a link to our available API hooks. You'll need to add something to display only respective languages. Your translated category will have a different ID, so perhaps you can pull the ID of the tranlsated category and display only posts in a certain language. Here's our library of hooks: https://wpml.org/documentation/support/wpml-coding-api/ |
December 6, 2023 at 4:49 pm #15010641 | |
jonathanF-3 |
The menus are also custom coded so i looked into it. You were right when you said to add something to display only respective languages. It was the same problem at both places. The query was made with get_posts() and i just added 'suppress_filters' => false to the arguments to solve the problems. Thanks for your help! |