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.
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.
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.
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.
- 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.
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.