Skip Navigation

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

Problem:
The client is facing an issue where custom links in the menu are not translated correctly from German to English using ATE. The links appear as /?product_cat=vehicle-type-car instead of the expected translated format like https://www.valtron.de/en/c/rear-view-cameras/f/vehicle-type-car/.

Solution:
We recommend adding the following code to the end of your

functions.php

file to address the issue:

// WPML Workaround for compsupp-7532
function wpml_compsupp7532_add_custom_blacklist_requests( $blacklist, $sitepress ) {
    // Add your custom request to the blacklist array
    // We can hardcode URL's, like:
    //$blacklist[] = "c/rear-view-cameras/f/vehicle-type-truck";
    // Or use REGEX. This regex should match slugs like "c/(any slug here)/f/(any slug here)" - we may need to adapt it if needed
    $blacklist[] = '/^c\/[^\/]+\/f\/[^\/]+\/?$/';
    return $blacklist;
}

add_filter( 'wpml_sl_blacklist_requests', 'wpml_compsupp7532_add_custom_blacklist_requests', 10, 2 );

After adding the code, save the file, make a small modification to the block content, and save. Then, update the translations. You may need to re-translate the links.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, 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. If further assistance is needed, 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.

Our next available supporter will start replying to tickets in about 5.76 hours from now. Thank you for your understanding.

This topic contains 22 replies, has 2 voices.

Last updated by Waqas Bin Hasan 3 weeks, 2 days ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 13, 2024 at 7:20 am #16064654

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I analyzed further and found that the "f" based filter is coming from "HUSKY - Products Filter Professional for WooCommerce" plugin and is dependent on this.

Unfortunately, "HUSKY - Products Filter Professional for WooCommerce" is not compatible with WPML (https://wpml.org/plugin/).

Because if you deactivate this plugin, the URL hidden link leads to a 404 not found. Since the plugin isn't compatible, WPML can not find the substitute (or translated) version for replacement.

However, if you simply change the link in HTML Block to hidden link and then translate in ATE to hidden link (the appropriate substitute), then it works just fine and is replaced in the menu also.

Attached are all the screenshots for your reference. I've tested with one link in the sandbox and you can try with the others too.

I recommend you to contact the plugin author and request a compatibility update. WPML offers very useful information for developers aiming to make their themes/plugins compatible. Please see https://wpml.org/documentation/support/ and https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/ for details.

Theme and plugin authors are welcome to join WPML’s Go Global program, which helps them make their code multilingual ready. Together with WPML’s compatibility team, they can test and confirm that their theme or plugin works with WPML. See https://wpml.org/documentation/support/go-global-program/ for details and you can refer your theme/plugin provider to this as well.

August 13, 2024 at 7:21 am #16064661

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Sorry forgot to attach the screenshots, please find with this message.

Screenshot 2024-08-13 121616.jpg
Screenshot 2024-08-13 121353.jpg
Screenshot 2024-08-13 121239.jpg
Screenshot 2024-08-13 121118.jpg
August 15, 2024 at 4:45 am #16072956

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Just an update, I discussed with the team and found out that the said plugin was previously called WOOF and is a recommended and compatible plugin with WPML.

Team has updated our list of compatible plugins to include it correctly at https://wpml.org/plugin/husky-products-filter-professional-for-woocommerce/.

So I'm working further on it and 'll probably escalate the issue for further investigation. I'll update you accordingly.

Please accept our apologies for the inconvenience.

August 15, 2024 at 11:39 am #16074163

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation. I've escalated the issue to our compatibility team and 'll get back to you accordingly.

August 28, 2024 at 5:44 am #16112477

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team has suggested the following workaround:

- Add the following code to the functions.php file:

// WPML Workaround for compsupp-7532
function wpml_compsupp7532_add_custom_blacklist_requests( $blacklist, $sitepress ) {    
	// Add your custom request to the blacklist array

  // We can hardcode URL's, like:
  //$blacklist[] = "c/rear-view-cameras/f/vehicle-type-truck";

  // Or use REGEX. This regex should match slugs like "c/(any slug here)/f/(any slug here)" - we may need to adapt it if needed
	$blacklist[] = '/^c\/[^\/]+\/f\/[^\/]+\/?$/';
    
  return $blacklist;
}

add_filter( 'wpml_sl_blacklist_requests', 'wpml_compsupp7532_add_custom_blacklist_requests', 10, 2 );

- Save the file.
- Add a small modification to the block content and save.
- Update the translations. You may need to re-translate the links.

We've tested this in different environments, including the sandbox I created earlier. hidden link">Here you can check the menu, now it contains proper translated links.

Please apply the workaround in your site and let me know.

August 28, 2024 at 9:19 am #16113627

nicoK-7

I have tried it on your sandbox and it really works.

But when I implemented your code on my site it didn't work.

Can you look around maybe I'm did something wrong?

August 28, 2024 at 1:26 pm #16115447

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I'll check soon and 'll get back to you tomorrow about it.

August 29, 2024 at 6:29 am #16117543

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

I was able to find and fix the problem. Actually you had to add that code at end of theme's functions.php file. Since you had added in somewhere middle, the further customizations in your code were making the problem.

I've added the code at end of functions.php file and then make little change (like ...) in the block's content, saved and updated the translation. After that I removed my change, saved again and updated the translation again.

And this is working fine now (see attached).

Screenshot 2024-08-29 112704.jpg
Screenshot 2024-08-29 112650.jpg
Screenshot 2024-08-29 112635.jpg
Screenshot 2024-08-29 110832.jpg
August 29, 2024 at 9:11 am #16118684

nicoK-7

Thank you to all support team for a fast and great support. I very appreciated for your work.

nicoK-7 confirmed that the issue was resolved on 2024-08-29 09:11:18.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.