Skip to content Skip to sidebar

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

Last updated by craigR-9 1 year ago.

Assisted by: Osama Mersal.

Author Posts
April 9, 2025 at 9:02 pm #16915962

craigR-9

Background of the issue:
I have implemented the language switcher using the shortcode in the header.php file: [wpml_language_switcher]. It works fine on most of the pages. However, on product category and custom category pages, it doesn't function properly. I have already added translations for all product categories in both Japanese and English. Here are screenshots of the issue: English version: hidden link Japanese version: hidden link. Link to a page where the issue can be seen: hidden link

Symptoms:
Only the current language is displayed in the switcher, instead of both available languages. On the Japanese version of a product category, only Japanese appears in the switcher. On the English version, only English appears. I am facing this issue only on the taxonomy term, even though the term is added in both languages.

Questions:
Why does the language switcher only display the current language on product category and custom category pages?
How can I make both languages appear in the language switcher on these pages?

April 10, 2025 at 8:30 am #16917219

Osama Mersal

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

1) Please add a footer language switcher and check if it will have the same issue.

2) If the footer language switcher has the same issue, please check if the issue persists in a minimal environment by following these steps.

1- Deactivate all the plugins except WPML CMS, String Translation, WooCommerce, and WooCommerce Multilingual.
2- Switch to a WordPress default theme like Twenty Twenty-one.

If the issue is gone, activate them one by one to see which one is causing an interaction issue.

❌ Please back up your database before the above test ❌

Best regards,
Osama

April 10, 2025 at 10:26 am #16917750

craigR-9

Thanks Osama.

The site is a live e-commerce site. Unfortunately there is no staged copy for testing. I would need to take the entire site offline to do what you're suggesting.

Initially at least, I was hoping someone with experience enabling the WPML lang switcher for custom category pages could run their eyes over the code. There may be some obvious red flags in the way the category pages are set up.

I've just posted to the job board on WPML requesting someone to do this. If you do have experience in this area and are willing to take a look, let me know and I'll send you login credentials.

Craig

April 10, 2025 at 10:28 am #16917753

Osama Mersal

Hi Craig,

I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.

Your answer will be private, meaning only you and I can access it.

❌ Please back up your database and website ❌

✙ I need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,
Osama

April 10, 2025 at 1:35 pm #16918918

Osama Mersal

Hi Craig,

Thanks for the access details. I created a local copy of your site to debug the issue without affecting your site.

After installing the copy, I was able to see the language switcher correctly without any changes. (Kindly check this hidden link">screenshot)

Please let me know if you can provide a staging site where we can check the issue without affecting your site.

If that's not possible, please let me know, and I'll create a site on our test server to which you can migrate your site for testing.

Best regards,
Osama

April 10, 2025 at 11:49 pm #16920613

craigR-9

Update: I have resolved the issue preventing me from creating a staging site. The staging site set up is in progress, I will provide an update once it's ready.

========================================================

Well that's a good start! Thank you.

I am on a WP Business plan which includes the ability to activate a staging site.

However, when I browse to the staging option it says it can't do it until Jetpack is connected (Jetpack seems to be running fine). I have a support request with Jetpack to fix this, though it may take some time (support provided via community-based forum).

Osama, if you don't mind setting up a test server, we will get a much quicker result.

Craig

April 11, 2025 at 12:09 am #16920620

craigR-9

Hi Osama,

I was able to set up a staging site via the WP dashboard, however the pages we need to troubleshoot don't work:

hidden link

It might be quicker if you set up a test server at your end.

Craig

April 11, 2025 at 12:40 am #16920675

craigR-9

Another update Osama!

The staging site is now working properly. The lang switcher works as it should on staging:

hidden link

I've run through some basic troubleshooting, but can't determine why it's working on staging but not production.

Craig

April 11, 2025 at 12:13 pm #16922605

Osama Mersal

Hi Craig,

Do you have a cashing mechanism on the live site that you don't have on the staging site?

I don't think it's a translation or WPML issue if it works on the staging site.

Best regards,
Osama

April 11, 2025 at 11:08 pm #16924774

craigR-9

Hi Osama,

Thanks for your help.

"Do you have a cashing mechanism on the live site that you don't have on the staging site?"

The only cache control in the WP dashboard I'm aware of is the Jetpack site accelerator, which is disabled.

The site is hosted on WordPress servers. When querying the server in terminal it shows:

cache-control: no-store, no-cache, must-revalidate (full query below)

"I don't think it's a translation or WPML issue if it works on the staging site."

Does this mean you will no longer provide support?

Craig

curl -I hidden link
HTTP/2 200
server: nginx
date: Fri, 11 Apr 2025 22:55:55 GMT
content-type: text/html; charset=UTF-8
strict-transport-security: max-age=31536000
vary: Accept-Encoding
x-hacker: Want root? Visit join.a8c.com and mention this header.
host-header: WordPress.com
set-cookie: PHPSESSID=8f01567c9f5e0ec820eeb74869443ddf; path=/
expires: Thu, 19 Nov 1981 08:52:00 GMT
cache-control: no-store, no-cache, must-revalidate
pragma: no-cache
vary: accept, content-type, cookie
link: <hidden link;; rel="hidden link"
link: <hidden link;; rel="alternate"; title="JSON"; type="application/json"
x-ac: 4.nrt _atomic_bur MISS
alt-svc: h3=":443"; ma=86400

April 12, 2025 at 8:04 am #16925020

Osama Mersal

Hi Craig,

Could you please check with the host support if there are any differences between the staging and live sites?

I'm trying to understand why it works on your staging site and my local copy.

Best regards,
Osama

April 12, 2025 at 9:31 am #16925091

craigR-9

Osama thanks for all your help, I managed to resolve the issue. Unfortunately, I can't pinpoint the fix to one particular thing. I spent a few hours tidying up the site and found later that I'd inadvertently fixed it.