Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
Redirect not working in Event plugin if translation is not available

Solution:
Client was using custom language switcher and all they need to hide it on event pages, while all other settings were fine.

Relevant Documentation:
- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-fix-styling-and-css-issues-for-the-language-switchers/
- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-display-or-hide-the-language-switcher-on-specific-pages/

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.

This topic contains 13 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 8 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 12, 2022 at 12:15 pm #11650193

maximilianv-3

I have one event plugin and I don't have german version of Events but still its taking me to the german version but I want to redirect it to the English only. This is not working.

July 13, 2022 at 10:23 am #11658003

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

May I ask you to look at the following guides and see if these are the options you are looking for?

- https://wpml.org/documentation/getting-started-guide/translating-custom-posts/
- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/#global-language-switcher-options

Please let me know if this helps resolve the issue. Or I'll try my best to further assist you on the matter.

Regards.

July 13, 2022 at 12:28 pm #11659389

maximilianv-3

Hi,

Thanks for the response and update. The solution which you provided is not helpful for me. Let me know if you want further detail description on the issue.

July 14, 2022 at 5:12 am #11663653

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Yes please I'll request some details and explanation on the issue or what you exactly want to achieve. As per my understanding, since there are no German translations for events, you don't want them to offer or redirect towards that.

Or in other words you want to offer only English language events, is this correct?

If yes, you can simply make Events "not-translatable". This way, the events won't be translated and eventually will have only the default language.

Please let me know, thanks.

July 19, 2022 at 4:48 am #11690005

maximilianv-3

Hi

Sorry for the late response. I tried the given solution and made the events not translatable using settings of WPML. But still it's not working. For example this is english URL of event.
hidden link

Please open this and click on de from the top menu and open it new tab you will find the difference.

July 19, 2022 at 7:21 am #11690399

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

I tried opening the link and can see "Oops, This Page Could Not Be Found!" on both (En/De).

IMPORTANT: Please take full backup of your website and database beforehand. It is highly advised to try the following on a staging/dev site first, so your live website isn't compromised.

On the other hand, I see that you are using "Language name added as a parameter". There should be no problem with this, but for testing purpose can you try "Different languages in directories" option as mentioned at https://wpml.org/documentation/getting-started-guide/language-setup/language-url-options/#different-languages-in-directories ?

If that does not resolve the issue then before proceeding further, may I ask you to try the following please?

- Deactivate all plugins except WPML and its addons and check for the issue.
- Activate each plugin one-by-one, while keeping check on the issue after a plugin is activated. This way you'll be able to pinpoint a plugin having a conflict (or problem), if any.
- If the problem persists, please repeat the above steps with a default theme of WordPress (i.e. 2022).
- Please also check the browser's console for any JavaScript errors. If you find any, please copy that in your next reply. See https://wordpress.org/support/article/using-your-browser-to-diagnose-javascript-errors/ for details on how to find these errors.

Please let me know if this helps resolve the issue. Or I'll try my best to further assist you on the matter.

Regards.

July 27, 2022 at 7:14 am #11747385

maximilianv-3

HI,

Sorry for the late response. As I tried the above things but still didn't find any solution.

July 27, 2022 at 11:09 am #11749825

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for trying those options.

May I ask for admin access to your website to check the issue in detail? You can create a separate admin user for this purpose, which can be deleted afterwards.

Also please provide following detail to investigate/observe the issue:

- detailed steps to reproduce the issue
- links to pages in admin and on frontend
- screenshots or screen recording if needed to explain
- any other relevant information to observe/investigate the issue

Please remember to take full backup of your website and database before proceeding. However, a staging/test site is highly recommended, because I may need to try some changes/fixes on the site, which may cause conflicts with the live site otherwise.

I've set your next reply as private to share this information safely.

IMPORTANT: If you don't see the section for providing access information, please do not write in the message box or the information may appear as public.

Please see https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security.

Regards.

August 4, 2022 at 12:24 pm #11802965

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for providing the details. I am working on this and 'll update you as soon as I have a solution.

Regards.

August 5, 2022 at 5:52 am #11808629

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

I've tried to login with the credentials you provided, but I am getting following error:

Error: The password you entered for the email address ******* is incorrect.

Can you please check and verify? And if needed, I've enabled your next reply as private again, so you can provide new credentials.

Also please confirm that it is ok to make any change if necessary? And please confirm that you have full backup of your website and database already? Usually we prefer a staging/dev site so live site isn't compromised.

Please confirm,

Thanks.

August 10, 2022 at 5:22 am #11837429

maximilianv-3

Hi Team,

I am still waiting for your response and update. As it's little bit urgent now so if possible please respond me ASAP.

August 10, 2022 at 7:28 am #11837971

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for your patience and my apologies for the delay, I was on holidays.

I was able to login and look for the issue, which is in fact not an issue. This is just a matter of understanding, let me explain.

I checked that Events is set to "Not translatable", which is fine and it means that there'll be no translation. So whenever someone tries to access a URL with language code in it (i.e. /de/ or ?lang=de), they should be redirected to the default language (English) and there should be no language code in the URL.

It is working exactly the same. All you need to customize or hide the language switcher from Event pages.

To support this, I switched to "Different languages in directories" in WPML -> Languages -> Language URL format and resaved the permalinks. But still on Event page's language switcher I see language name added as a parameter (i.e. ?lang=de) while it should be /de/.

However, besides this test, since Event is not translatable, there should be no language identification in the URL. And in face, default language switcher of WPML 'll never show up for a page/post which has no translation available.

So I'll suggest a simple workaround for your custom menu and/or design that you can simply hide or not-include those En/De language switching on Event pages and your issue should be solved.

I hope this helps you understand and fix the issue for your custom design and approach towards the language switchers. Please see these guides about how you can achieve that:

- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-fix-styling-and-css-issues-for-the-language-switchers/
- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-display-or-hide-the-language-switcher-on-specific-pages/

Please also remember that if Events have been translated in the past and if those translations still exist/publish in your site, those may be still accessible. You may also want to remove those translations (for events), if you only want English (default) be the only accessible language for this post type.

Regards.

August 10, 2022 at 10:22 am #11839273

maximilianv-3

Ok I will hide language switcher for german pages.

August 10, 2022 at 11:03 am #11840103

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your understanding. I'll consider this matter resolved. Please feel free to open a new one whenever you need further help about WPML and related.

Have a nice day!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.