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.
Our next available supporter will start replying to tickets in about 3.27 hours from now. Thank you for your understanding.
Tagged: Custom Work
This topic contains 9 replies, has 2 voices.
Last updated by Bruno Kos 1 year, 2 months ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
February 27, 2023 at 2:52 pm #13125861 | |
Adnan |
I use bbpress with wmpl and have the same structure like this support forum here. Only forums are translatable, topics and replies are not. When I create a topic in English forum : mysite.com/forum/en/topic/english-topic It shows me the topic with another permalink: mysite.com/forum/de/topic/english-topic So, I have two different links showing the same content. If I set the topics to "Translatable - only show translated items". The redirection to default language works BUT all topics which are not in default language are not showing up in forums. Probably because these topics are only in non-default language. In this wpml forum this is working; For example this topic in German Forum: ( I assume German is not default language) (English link -> German topic) (French link -> German topic) etc ... I wonder how can I also achieve this? |
February 28, 2023 at 1:26 pm #13135989 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Thank you for contacting WPML support! The redirection to default language works BUT all topics which are not in default language are not showing up in forums. Probably because these topics are only in non-default language. This is correct - fallback only works if something is created in site default language, otherwise it will only show language switcher to any of the other languages without fallback, so not the other languages. E.g. if something is created in Spanish which is not the site default language, even if fallback is set language switcher will only show the Spanish flag. As for what we use in our website, our bbpres installation is quite modified, also I see that you are using nginx so the server rules may not apply to your case. We can detect non-existing URLs by htaccess but we can't find correct URL via htaccess. So rule will be something where all 404 pages will go to the fixed language URL with their counterpart, while this will require custom logic to get the correct URL from the database. You could also check https://developer.wordpress.org/reference/functions/redirect_canonical/. The best way to get such redirection in place is that you check with our https://wpml.org/contractors/ to go such solution for you as we consider such request as a custom work not within the support scope. Regards, |
February 28, 2023 at 8:09 pm #13139541 | |
Adnan |
Hi Bruno, Thanks for your explanation. I expected, wpml made some custom modifications to achieve this in this forum. I also do some coding but a server redirection rule combined with wp database select is something I never did before. If you have an example for me (must not be nginx),it would be a very helpful starting point for me. Thanks in advance, Adnan |
March 1, 2023 at 8:34 am #13142431 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, For WPML officially supported hooks, you can have a look on https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/, while for htaccess there are numerous resources on websites such as stack overflow. But given the complexity of our system and lots of custom things there, there aren't any quick pointers I can give you. This is simply a work for our https://wpml.org/contractors/ who you should consult to code this for you. Regards, |
March 2, 2023 at 4:40 pm #13157371 | |
Adnan |
Thanks, I checked the links. But, I don't understand why wpml is showing the content instead of giving the 404 page. If I had 404, this would probably make it easier to solve this problem. Is there anyway to deactivate it? For example: When I create a topic in English forum : mysite.com/forum/en/topic/english-topic This should give 404 instead of showing the topic: mysite.com/forum/de/topic/english-topic Thanks. Adnan |
March 3, 2023 at 8:06 am #13161101 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, The "nearest" setting for it is if you set replies to be "Translatable only show translated items". However this may not be enough because this is where WordPress steps in: Because it will automatically redirect based on the slug and then if for example in some other language you try to access hidden link, but such URL does not exist, it would to go to hidden link automatically without 404 because this is what WordPress does. So this is just another layer of customization on top of everything. Regards, |
March 3, 2023 at 9:10 am #13161665 | |
Adnan |
"Translatable only show translated items" for topics and replies was the first thing I tried and solves the redirection problem but breaking other things in the forum. Therefore, I need topics and replies to be "Not Translatable". But, I cannot find why wpml is showing the content even the URL does not exist. For example, I expect this URL to give 404: mysite.com/forum/de/topic/english-topic Many thanks for your help. |
March 3, 2023 at 9:37 am #13162009 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, It will not show it because WordPress will try to redirect based on the slug automatically. Please understand that this is a outside of the support scope and I cannot assist on this matter, this is a work for our https://wpml.org/contractors/ who you should consult to code this for you. Regards, |
March 3, 2023 at 10:04 am #13162225 | |
Adnan |
Hi Bruno, WordPress is not redirecting based on the slug, this is my main problem. (for not translatable post types in settings) I don't see a redirection here: hidden link or here: hidden link The same content is displayed for different urls. There is no redirection. If you still think this is out of scope, you can close the ticket. Regards. |
March 3, 2023 at 10:14 am #13162389 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Setting them as not translatable will not make these URLs disappear or 404, this is only a matter of setting within the WPML whether we allow translation of these or not. Regards, |