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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 |
- | - | - | - | - | - | - |
Supporter timezone: America/Lima (GMT-05:00)
Tagged: Documentation request
This topic contains 16 replies, has 0 voices.
Last updated by Andreas W. 10 hours, 45 minutes ago.
Assisted by: Andreas W..
Author | Posts |
---|---|
February 7, 2025 at 2:37 pm #16680225 | |
vitaliiO |
I've created 2 new pages: test-page-1 and test-page-2. Did all the steps and the link still points to main language. Link in previous message is acf link field, which is children of block, that is childern of Flexible Content |
February 7, 2025 at 4:27 pm #16680626 | |
vitaliiO |
help me |
February 7, 2025 at 10:03 pm #16681351 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Hi, I would like to offer to take a closer look and request temporary access (wp-admin and FTP) to the site to investigate the issue further. The required fields are below the comment section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it. IMPORTANT If you can't see the "wp-admin / FTP" fields, your post and site login details will be set to "PUBLIC". DO NOT publish the data unless you see the required wp-admin / FTP fields. The private reply form looks like this: The next time you reply, click on "I still need assistance". Video: Please note that we are obliged to request this information individually on each ticket. We are not allowed to access any credentials that were not specifically submitted on this ticket in the private response form. Best regards |
February 7, 2025 at 10:57 pm #16681404 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Your field groups are not configured correctly. Repeater Fields, Groups, and Flexible content fields need to be set to "Copy once" or "Copy". All your fields are set to "Not translate". As long as a field is set to "Not translate", nothing will happen if you translate the page. You need to set the link fields to "Copy" to copy the link or to "Translate" to translate the link. Please follow this guide to set up the fields: Copy > The field value will be copied every time you translate content Copy once > The field value will only be copied once (use this only if you translate posts or pages with the WordPress Editor) Translate > The field will be available inside the translation editor for translation After making changes to the fields you will need to edit the fields again on the original page, save the page, and then open the translation editor. |
February 8, 2025 at 1:38 pm #16682319 | |
vitaliiO |
Hello, Here’s what I did: 1. Set a "Flexible Content" field to "Copy". "This is why the link field is set to 'Copy' by default and does not appear in the WPML Translation Editor. In this case, it should automatically use the translated URL if the linked page is translated and published." So I expected the link to the first page to be automatically changed to the French version after translation. |
February 8, 2025 at 4:04 pm #16682638 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
We do have a known issue for this use case which is already escalate to our development team. Please take a backup of your site incl. database and try to apply the following workaround: Workaround private function get_text_type( $text ) { $type = 'LINE'; if ( is_array( $text ) ) { $type = 'array'; } elseif ( strip_tags( $text ) !== $text ) { $type = 'VISUAL'; } elseif ( strpos( $text, "\n" ) !== false ) { $type = 'AREA'; } return $type; } with private function get_text_type( $text ) { $type = 'LINE'; if ( is_array( $text ) ) { $type = 'array'; } elseif ( strip_tags( $text ) !== $text ) { $type = 'VISUAL'; } elseif ( strpos( $text, "\n" ) !== false ) { $type = 'AREA'; } else if (preg_match('/^(?:https?):\/\/\S+/i', $text)) { $type = 'LINK'; } return $type; } |
February 8, 2025 at 4:48 pm #16682720 | |
vitaliiO |
I've made changes to this file: You can see the changes in the screenshot. I repeated all the steps by creating two new pages and adding a link from the second page to the first. However, the link still points to the main language. |
February 8, 2025 at 5:02 pm #16682793 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
You are using a version of ACF PRO that was released in November 2023. Also, WPML and our addons are outdated. Please update all plugins and then test again. |
February 9, 2025 at 1:44 pm #16684086 | |
vitaliiO |
Hi, I updated the WPML, WPML addons and ACF Pro plugins, created two new pages again, translated them, and the links still point only to the main language. You can try creating two new pages yourself and following these steps. |
February 11, 2025 at 12:12 pm #16691388 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
As you can see on the screenshot, your field group is still not configured correctly. If you use the "Expert" mode you need to follow this guide: If you have doubts about how to set each field, please use the group settings: - Same fields across languages (for translation with the WPML Translation Editor) |
February 11, 2025 at 1:46 pm #16691967 | |
vitaliiO |
Hi, almost all my pages are built using Flexible Content. This is the 'Components Page' field group, as you can see in the screenshot. It seems to be configured correctly. I have properly configured the 'Stats Banner' block, which is a child of Flexible Content. You can check it. |
February 11, 2025 at 2:00 pm #16692027 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Thank you for the details. I went through half of the group and there are various configuration issues. For example, all the Repeater Fields were set to "Translate". They should be set to "Copy". Now, this is a huge group and I can not go through it all for you. If you want to save time, and if all your links ar internal links anyways, then please set the field group to "Same fields across languages" and then translate the page again. This usually should solve the issue. |
February 11, 2025 at 3:38 pm #16692667 | |
vitaliiO |
In fileds group "Components Page" (flexible content) I set Repeater Fields, Groups, and Flexible content fields to "copy". I created again new pages (hidden link) and built it with "Components Page" (flexible content) blocks. But the link still points to main language. |
February 11, 2025 at 6:04 pm #16693212 | |
Andreas W. Supporter Languages: English (English ) Spanish (Español ) German (Deutsch ) Timezone: America/Lima (GMT-05:00) |
Ths issue is inside your template. Using the following approach solves the issue while keeping links on "copy". if ($row === 'stats_banner') { $image = get_sub_field('image'); $src = wp_get_attachment_image_src($image['id'], 'thumb_2000_0'); echo '<div class="stats-banner" style="background-image: url(' . $src[0] . ');" data-colour="dark">'; echo '<div class="stats-banner__content container">'; echo '<div class="stats-banner__stats">'; echo '<div class="stats-banner__left-stat">'; $largeStat = get_sub_field('large_stat'); if ($largeStat) { echo '<span>' . $largeStat . '</span>'; } $text = get_sub_field('text'); if ($text) { echo $text; } echo '</div>'; $colourBox = get_sub_field('colour_box'); $firstColour = $colours[$colourBox['colours']['first']]; $secondColour = $colours[$colourBox['colours']['second']]; // Translate the link and title $link_url = $colourBox['link']['url']; $link_title = $colourBox['link']['title']; if ($link_url && $link_title) { // Translate the URL (if needed), WPML generally handles URLs of translated pages $translated_link_url = apply_filters('wpml_permalink', $link_url); // Translate the link title (if the title is a translatable string) $translated_link_title = apply_filters('wpml_translate_string', $link_title, 'acf', 'link_title_' . $colourBox['link']['title']); // Output the translated link echo '<div class="stats-banner__right-stat" style="background: linear-gradient(to right, ' . $firstColour . ' 40%, ' . $secondColour . ' 40%);">'; if ($colourBox['top_text']) { echo $colourBox['top_text']; } if ($colourBox['stat']) { echo '<span>' . $colourBox['stat'] . '</span>'; } if ($colourBox['bottom_text']) { echo $colourBox['bottom_text']; } if ($translated_link_url) { echo '<a href="' . $translated_link_url . '">' . $translated_link_title . '</a>'; } echo '</div>'; } echo '</div>'; echo '</div>'; echo '</div>'; } Using the 'wpml_permalink' hook in your template will make sure that the correct URL will be loaded for each language. This will automatically adjust the link without the need to translate it. The downside is, that you will not be able to translate the link text, as it is being copied. To translate the link text, the link field would need to be set to "Translate" but this would include that you also need to translate the links. |