Skip Navigation

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

Problem:
When navigating through the main menu on a multisite setup using WPML with subdomains, the AJAX request URL incorrectly switches to an English URL (https://en.fme.de/wp-admin/admin-ajax.php), causing the site to fetch English content instead of the intended language. This issue persists despite disabling related plugins and occurs specifically when using the Divi FilterGrid.
Solution:
1. Ensure that your WPML plugin and all related add-ons are updated to the latest version. You can check and update from WPML Installation Guide.
2. Verify that the issue isn't due to a compatibility problem between WPML and the Divi FilterGrid. If you're using posts or pages within the grid, change their settings in WPML > Settings > Post type translation to 'Translatable'.
3. Check if the issue also occurs with a regular Divi grid widget or only with the FilterGrid addon.
4. If the problem is due to the plugin not being officially compatible with WPML, consider contacting the plugin author to discuss making the plugin compatible through WPML's GO Global program. More details can be found here: GO Global Program.
5. For AJAX calls, ensure proper language handling by following the guidelines provided here: Handling AJAX with WPML.

If these steps do not resolve your issue or if the solution seems outdated or irrelevant to your specific case, we highly recommend checking related known issues at WPML Known Issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML Support Forum.

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

Last updated by Dražen 1 week ago.

Assisted by: Dražen.

Author Posts
November 18, 2024 at 1:13 pm #16414899

tinaL-5

Hintergrund des Themas:
I am using WPML with multiple languages via subdomains and have a multisite setup with active sunrise.php. I am trying to navigate to the 'referenzen' page and use the filter grid or pagination. I also use 'Max Mega Menu' and the Divi builder. Disabling Max Mega Menu and WP Rocket did not resolve the issue.

Die Symptome:
When I open hidden link and navigate to 'referenzen' via the main menu, the AJAX request URL changes to hidden link, causing WordPress to fetch English content instead of the intended language. When I directly access the url, everything works as intended.

Fragen:
Why does the AJAX request URL change when navigating through the main menu?
How can I ensure the correct language content is fetched when using the menu?

November 18, 2024 at 9:07 pm #16416535

Andrey
Supporter

Languages: English (English ) Russian (Русский )

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

While one of my teammates takes care of your ticket, I will provide you with the first debugging steps.

Please update your WPML plugin and add-ons to the latest version, 4.6.14, to benefit from the latest bug fixes and improvements. This may not necessarily resolve your problem; however, we need to work on the newest code available to troubleshoot the issue best.

You can check the latest released versions under "My Account -> Downloads" on this site. Instructions to update can be found here: http://wpml.org/faq/install-wpml/

If you do not see the updates, you might need to click the Check for updates button in the Plugins → Add New Plugin → Commercial tab.

Please remember to backup your database before you proceed.

Let us know if the issue persists after an update has been done. Please upload any relevant screenshots or links that would help illustrate the problem. I want to ensure that I fully understand the issue at hand so that I can provide the best possible solution.

November 19, 2024 at 11:47 am #16419235

tinaL-5

Hi,

Your AI based first support suggested this and I have already done an update. This did not resolve my issues and I have already reported this. I am waiting for your teammates to look into this, thanks.

November 25, 2024 at 8:50 am #16438279

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have tried to check the issue, but if I follow your steps I see DE content, not EN. hidden link

Can you please explain how can I see the issue?

Regards,
Drazen

November 25, 2024 at 10:21 am #16438983

tinaL-5

Hello Dražen,

thank you for taking care of the problem.

If you open hidden link directly, everything works as it should. However, if you open hidden link (or another subpage) and then click on ‘References’ at the top of the menu, the following problem occurs:

If you click on the pagination below the grid or click on one of the filters, only English-language content is displayed in the grid. If you then reload the page, the German content is displayed again, as the content is loaded directly and not via AJAX.

The dev tools also show that the Ajax call is made via hidden link when the link is called directly. If I go to the references via the main menu of the page, the Ajax call of the German page runs via the English site: hidden link

Screenshot-fme-de.jpg
November 25, 2024 at 10:32 am #16439168

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for getting back, I understand and can see the issue.

Can you try to enable the next option: Go to WPML → Languages and scroll down to the Language filtering for AJAX operations section. There, check the Store a language cookie to support language filtering for the AJAX option.

- https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/

If the issue still happens, can you share more info if this was created using regular Divi widgets or an additional 3rd party?

Regards,
Drazen

November 25, 2024 at 10:49 am #16439222

tinaL-5

Thank you for the quick response. That was one of the first measures I tried out. When I deactivate the language cookies, the English content is always loaded straight away. So basically it works with language cookies. I use the Divi filter grid: hidden link

However, I suspect that the change might have something to do with the synchronisation of the different language main menus. I use max mega menu for the menus, but the problem also occurs when I use the native menu. I have also tried not to reference the page in the menu, but to use a custom link to the references, but this did not work either.

Strangely enough, the wp-wpml_current_language cookie is always set to ‘de’ in both ways

November 25, 2024 at 11:09 am #16439278

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for getting back.

I do not think that menus could be related, but probably WPML and Divi FilterGrid compatibility, as it is not loading the correct language content. This can happen for not officially compatible WPML plugins.

1) Not sure if you are loading posts or pages in this grid, but I see they are set to Display as translated. Can you please set them to Translatable from WPML > Settings > Post type translation and check again?

2) Can you check if the same issue happens with a regular Divi grid widget or only with FilterGrid addon?

Thanks,
Drazen

November 27, 2024 at 12:56 pm #16449826

tinaL-5

Hey and thanks for your ongoing support.

1) The problem here is, that I need the fallback option for all english content, because our romanian und indian references are just the english original. This also works for the content that is not translated into german. There I implemented a small info banner that says "only in english", but with this ajax problem only the english translations are shown and absolutely no german content.

2) The regular divi grid does not have a AJAX-filter so I had no chance to test this out. I can search for another plugin that uses those kind of filters.

November 27, 2024 at 1:15 pm #16449938

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks.

1) That can be the problem, can you please try to check if changing this helps?

2) I am not sure but could be a compatibility issue with this plugin. We can check and try to help, but in the end it might need author collaboration and joining our compatibility program to make it compatible.

Please try to reproduce same issue on this next test site. You can just create few dummy posts, and 1 page with same filter grid and check if the issue still happens.

- hidden link

Regards,
Drazen

December 2, 2024 at 10:48 am #16465470

tinaL-5

I just created three dummy posts and have tried to reproduce the behaviour. The biggest difference here, however, is that I work with different language domains in my live environment. As long as I only use different languages and in different subdirectories, the behaviour that the Ajax call runs via the wrong language domain cannot really be reproduced from my point of view, or what do you think?

December 2, 2024 at 11:32 am #16465680

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

1) that should not be the case, if the issue is with the language cookie, it should also happen with these settings.

Please try to reproduce, if not, you can check on your website if the issue happens only when using domain per language. Please make sure to create a backup, before doing any actions, just in case.

2) If you still can not reproduce the issue on test site, and the issue only happens on your website, I suggest creating a staging site to test few things and so we can also further debug if needed. You can there try the following:

- Make sure you have a backup.
- Disable all other plugins and leave active only WPML plugins and Divi filter
- Switch to Divi parent theme
- Check if the issue still happens.

Let me know how it goes.

Regards,
Drazen

December 4, 2024 at 12:08 pm #16476401

tinaL-5

Thank you for your good support.

Update:
Deactivating the fallback language did not change anything.

I have setup a dev site with a clone of the live page. There I managed to deactivate any plugin that is not crucial for the site, languages and the grid.

I realised that the developers of the filter grid are using

'ajaxurl' => admin_url( 'admin-ajax.php' ) to build the code for the ajax call.

And as soon as I click on a link on the main menu, admin_url changes the value to the english standard domain (hidden link) when I access the page directly the value is hidden link.

Does this help you to narrow down the problem?

I can also create you an account to the dev site if that helps. Where can I post the credentials?

December 4, 2024 at 12:17 pm #16476523

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for getting back and doing great debugging work 🙂

I think actually that might be the reasons for the issue you have, and why it happens only with domain per language.

Since the plugin is not officially compatible and would need adjustment in code, best would be to share your findings with the plugin author, and invite them to the GOGlobal program if they need our help and want to be officially compatible with WPML; we would be glad to help and collaborate. (https://wpml.org/documentation/support/go-global-program/)

Also, they might want to check our suggestion for Ajax calls and WPML in the next section to have proper language shown:

- https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/#:~:text=default%20language%20content%20%2B-,Solution%3A,-When%20building%20custom

Let me know how it goes and if there is anything else we can do from our side to help.

Regards,
Drazen