Skip Navigation

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

Problem:
The client reported an issue with the

wpml_sl_blacklist_requests

filter not working when URLs contain escaped characters encoded in Unicode with more than two triples of characters, such as %AB%CD%EF.

Solution:
We realized that the client translated the URLs using the WPML Translation Editor while using the same URL in each language and this typically results in URLs pointing to the same content across different languages. We also added a new link to the client's test page that worked as expected, indicating that the correct implementation of the filter should resolve the issue. Take note that WPML will by default not display internal links on the WPML Translation Editor and it will auto-adjust the internal links once the contents that are being linked to are translated and published.

If you're experiencing a similar issue, we recommend checking that you are using the WPML Translation Editor to translate your URLs. If the problem persists, it might be due to an outdated solution or a different cause. In such cases, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket with us.

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.

Tagged: ,

This topic contains 5 replies, has 3 voices.

Last updated by Andreas W. 2 weeks ago.

Assisted by: Andreas W..

Author Posts
April 30, 2024 at 11:21 am #15580924

olegA-5

The "wpml_sl_blacklist_requests" filter fails if the URL contains escaped characters that are encoded in Unicode with more than two triples of characters, i.e. in the format %AB%CD%EF (if there are only characters that are encoded with two triples, i.e. %AB%CD, the filter works). Specifically:
$blacklist[] = 'en/documents/council-of-europe/convention-for-the-protection-of-human-rights/'; - WORKS, NO ESCAPED
$blacklist[] = 'fr/documents/conseil-de-leurope/convention-europ%c3%a9enne-des-droits-de-lhomme/'; - WORKS, ONLY TWO TRIPLES
$blacklist[] = 'fr/documents/conseil-de-leurope/convention-europ%c3%a9enne-des-droits-de-lhomme/protocole-n%E1%B5%921/'; - DOES NOT WORK, THREE TRIPLES.
I need the last one to work.

April 30, 2024 at 11:28 am #15581003

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons.

You can access the WordPress dashboard using the link below:
- hidden link

Kindly follow the steps below:
- Try to replicate the issue.
- Share with me step by step guide on how can I check the issue

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

April 30, 2024 at 2:26 pm #15581705

olegA-5

For some reason, I can't get WPML to substitute links to translated content in the Sandbox (without that, changing functions and trying anything else is pointless). I have created the "Test 7" page. There are three links on it. The first one leads to another page I created in French ("page nᵒ 7). The second one leads to an English translation of this page (" I created the translation"). The third leads to another page in French, "page 7". This page is also translated into English. I have created a translation of the "Test 7" page. I expect that WPML should change the links on the translated "Test 7" page to English ones, i.e. change the links to the French pages (the first and third links) to English ones (since these pages are translated to English). However, WPML does not do this. Translate Link Targets doesn't detect any links that should have been adjusted. I'm probably doing something wrong. Somewhere something is not enabled, not activated.

May 4, 2024 at 3:10 pm #15593566

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

It looks like you translate the URLs on the WPML Translation Editor which is why it would be expected that they point to the same content.

I have added another link to your test page now which works as expected.

urls.png
May 5, 2024 at 1:04 pm #15594313

olegA-5

Nope, I didn't do the translations of the URLs in ATE. For some reason ATE did those translations itself. That is, for some reason it "registered" the URLs as requiring translation and inserted those translations. Yes, that's the real thing. I don't see this behaviour of ATE on my site. As for the page you added, I see that you added it via Gutenber-editor (or what is it called?) in the format href="/?page_id=114. I don't use that format in principle. All my links are full and absolute. And I absolutely do not use Gutenber-editor.

May 7, 2024 at 4:53 pm #15603257

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

When we ask you to recreate the issue, it means that you recreate the issue identically as it occurs on your website, which means using the same method to create the content.

Also, as you can see on my new page "Test" the links do not appear on the WPML Translation Editor if they are internal links. I am not sure which steps you took, that caused the links to show up on your earlier example.

Would it be possible to have a look into the issue as an admin on your website? If so, could you please name an example on which I can see the issue?

If so, I will enable a private reply form for you to provide access.

Test.png
May 9, 2024 at 2:14 pm #15610991

olegA-5

Actually, I was able to get blacklist to work on my site

The problem was caused by the fact that WPML was actually substituting fragments from the old translation into the new translation, which - as it happened - differed only in what the URL was. So it felt like the new translation was being processed incorrectly. When I was able to solve the problem with WPML substituting a fragment from the old translation instead of the new translation, everything was resolved, because the blacklist itself works correctly. In other words, there is a problem, but it's not what this ticket is about. So I'm closing it, thank you!

By the way, I noticed that now WPML on my site has started _in some cases_ registering the URL for mandatory translation (and inserting the translation) if it's a blacklisted URL. This didn't happen before. Now it does. This is some kind of change. However, this is not always the case. I.e. when translating the same page into different languages in ATE, the URL may or may not appear in ATE as a URL to be translated (already automatically substituted into the translation).

olegA-5 confirmed that the issue was resolved on 2024-05-09 14:14:46.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.