This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with WPML automatically translating or altering URLs in your content blocks, particularly for buttons within Gutenberg blocks, this might be due to WPML's default behavior of processing URLs on the fly.
Solution:
We recommend two approaches to prevent WPML from altering your URLs:
1) Add a custom XML configuration to instruct WPML to copy the URL as-is instead of translating it. You can add this configuration directly in your theme or plugin, or through WPML's settings under 'Custom XML-Config'. Here's an example of what your configuration might look like:
<wpml-config> <gutenberg-blocks> <gutenberg-block type="your/block-name"> <key name="url" action="copy"></key></gutenberg-block> </gutenberg-blocks></wpml-config>
Make sure to replace 'your/block-name' with the actual name of your block and 'url' with the attribute key.
2) Disable WPML's link rewriting during rendering by adding a filter in your theme's functions.php file:
add_filter('wpml_translate_link_targets', '__return_false');Alternatively, for a more aggressive approach:
add_filter('wpml_permalink', function($url) { return $url; });If these solutions do not resolve your issue, or if they seem outdated or irrelevant to your specific 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 the problem persists, 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 1 replies, has 0 voices.
Last updated by 1 month, 2 weeks ago.
Assisted by: Marcel.