Skip Navigation

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

Problem:
The client is experiencing issues with the WPML language switcher on their site. When switching to Arabic, the URL incorrectly shows /ar/fr instead of just /ar. Additionally, search results do not match the set language, always defaulting to Spanish.
Solution:
We have identified that the issue with the language switcher URL showing /ar/fr instead of /ar is due to a redirection that eventually leads to the correct /ar URL. This behavior suggests that the problem might not be directly related to WPML but could be due to a compatibility issue with another plugin. We recommend setting up a staging environment or providing a Duplicator package of your site so we can further investigate this issue in isolation from other plugins.

For the issues related to search results not appearing in the selected language, please open a separate support ticket with detailed examples so we can address this specifically.

If this solution does not resolve your issue or seems irrelevant, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should the problem persist, please open a new support ticket.

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 6 replies, has 3 voices.

Last updated by Marcel 10 months, 2 weeks ago.

Assisted by: Marcel.

Author Posts
August 21, 2024 at 12:51 pm #16090443

mohamed-amineD

Background of the issue:
I am trying to use WPML on my site hidden link. I am following the WPML documentation.

Symptoms:
When I change the language, I can't switch back to another language. When I switch to Arabic, it shows /ar/fr instead of /ar. In the search bar, even if the language is set to French, search results appear in Spanish. When searching for a product in the chosen language, it doesn't show up; I always have to type it in Spanish.

Questions:
How can I fix the issue where the language switcher shows /ar/fr instead of /ar?
Why do search results appear in Spanish even when the language is set to French?
How can I ensure that product searches return results in the chosen language instead of Spanish?

August 21, 2024 at 1:05 pm #16090540

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

Thanks for reaching out to us with the details.

Before this ticket gets assigned to one of my colleagues, I will try to help.

It sounds like you're encountering a few issues with the language switcher and search functionality on your site.

For the language switcher showing `/ar/fr` instead of `/ar`, this usually happens if the URL format settings in WPML aren't set up correctly. We might need to check those settings to ensure everything is configured properly but it seems that specific countries are excluded in your hosting security settings and we can't access the site (please check the attached screenshot).

Regarding the search results showing in Spanish even when you're set to French, it might be related to how the products are indexed or how the search function is configured. It's important to make sure that the products are properly translated and that the search functionality is set up to pull results based on the selected language. But please open a new ticket for that.

Per our Support Policy, we can handle only one issue per ticket.

Continuing with one issue per ticket helps not only supporters to focus on one issue at once, but also enables other users to find solutions to their questions faster.

We'd love to help you troubleshoot these issues further (let's handle the first issue in this ticket - the one related to the language switcher, and please create a new ticket for the other issue).

We would like to request temporary access (wp-admin and FTP) to your site so I can better examine the issue. The needed fields are below the comment area. When you log in to leave your next reply, the information you enter is private, meaning only you and I can see and access it.

Our Debugging Procedures

We will check various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to back up the site before providing us access. In the event that we do need to debug the site further, we will duplicate it and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information.
Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please back up the site files and database before providing us access.

If you do not see the wp-admin/FTP fields, your post and website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box.

The private box looks like this: hidden link

We will be waiting for your response.

Mihai Apetrei

August 22, 2024 at 11:57 am #16094742

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

Thanks for providing access.

I'm unable to reproduce the issue because your site at hidden link takes several minutes to load. When I check via cURL, it shows a 301 redirect, and after a few minutes, the site eventually loads. This behavior seems to be occurring outside of WordPress, which suggests there might be a server misconfiguration (as the /ar response is empty and shows a different HTTP header)

Could you please provide more details on how I can reproduce the problem?

Best regards,
Marcel

August 23, 2024 at 8:20 am #16097590

mohamed-amineD

The loading issue has been resolved. Please check now and address my issues. Additionally, I have a new issue. Here is another issue. For example, if you access microespana.com and translate it to French, using the search bar with the French language won't yield any results. You need to type in Spanish to find what you're looking for.

August 23, 2024 at 12:32 pm #16098538

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

ar/fr as language URL is only viable on the language switcher. If you click it, you are redirected to /ar:

hidden link

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Date: Fri, 23 Aug 2024 12:19:00 GMT
Server: Apache
Location: hidden link
Content-Length: 239
Connection: close
Content-Type: text/html; charset=iso-8859-1

>>> hidden link;

> --------------------------------------------
> 200 OK

I can't confirm whether any issue was caused by WPML here. There is no indication in the HTTP route that they come from us (X-Redired-By attribute). Please provide a staging environment or Duplicator package from your site where we can test the same isolated without any other plugins. I suspect there is a compatibility issue with a 3rd party plugin.

For your other issues, please create a separate ticket, as mentioned by my colleague Mihai above, with clear instructions/examples on how we can reproduce it. Then we can look at that, too; in this ticket, let's focus on the first reported issue regarding the language switcher.

Best Regards,
Marcel

August 24, 2024 at 5:48 am #16099867

mohamed-amineD

You can debug the website I have backup

August 26, 2024 at 12:51 pm #16104565

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

I can't test this on your environment, as the FTP credentials are not working. If I deactivate something, the site can go down, and I cannot restore it via FTP. I used the already active WP All Import plugin to create a clone to test this locally on my system.

Here, the issue doesn't happen; therefore, we can confirm that WPML does not cause it, and the redirect occurs only in your hosting environment. I recommend you reach out to your web hoster.

Best Regards,
Marcel

fr.png