Skip Navigation

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 4 replies, has 2 voices.

Last updated by Bobby 1 year, 11 months ago.

Assisted by: Bobby.

Author Posts
July 18, 2023 at 8:52 am #14056529

monih

I want the user to redirect to homepage if he click on language flag on category that not translated.

In the language switcher i set to redirect to homepage if there is no translation

The site default language is Hebrew and the translation is in English.
I'm not translating the all website categories to English because its a songs website so what I need is if user is in a song category page in Hebrew and click on the US flag I need to redirect the user to the English homepage because there is no translation for the category page but the user redirect to English page with Hebrew text and not to English homepage.

You can see it live here (this is a Hebrew category that not translated to English):
Go to hidden link
click on the US flag you will not redirect to English homepage and you will see English template with Hebrew text.

Please help.

Thanks
Moni

July 18, 2023 at 7:35 pm #14061891

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi Moni,

This is happening because the category has an existing translation for English, this feature will only work if the category has no translation to English. (even if it is not translated it looks like the translation page has been created for English for that category)

hidden link

You would need to remove the translation of the category.

If you don't need to translate your categories, at first you need to set it to fallback to the default language in case there's no translation available for categories as you can learn at: https://wpml.org/documentation/getting-started-guide/translating-post-categories-and-custom-taxonomies/#enabling-translation-of-a-custom-taxonomy.

For those categories already translated you can delete them from your WordPress Dashboard > Posts > Categories you can just change to the language you need to delete the category term, using the top admin bar language switcher, then you should be able to edit/delete it.

Let me know your results, please.

July 19, 2023 at 6:43 am #14062673

monih

Hi Bobby,
The category in our example have no translation because its a song category (no translation for songs categories in this site) this is why you see Hebrew content in En Language, in this case I need to redirect the user to the English homepage and not displaying the category description in Hebrew if the user click on US flag while he is on a Hebrew category.

Do I miss something?

Thanks
Moni

July 20, 2023 at 3:18 am #14069043

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi Moni,

from my side it looks like it actually has a translation even though the content is not translated the translated version of the category exists which is why it's not redirecting to the home page instead.

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

July 24, 2023 at 8:53 pm #14092541

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for the access details!

I can see what is causing this behavior.

- Go to WPML->Settings->Taxonomies Translation -> Categories (category)

It's currently set to "Translatable use translation if available or fallback to default language" which is why it looks like the translation exists when I reviewed the page even though it does not.

Set it to "Translatable only show translated items" and it will resolve the issue you are experiencing.

July 25, 2023 at 6:40 am #14093285

monih

Thanks for your help, all is working 100% now 🙂