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 |
---|---|---|---|---|---|---|
- | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - |
- | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | - |
Supporter timezone: Europe/Zagreb (GMT+02:00)
Tagged: Compatibility
This topic contains 10 replies, has 0 voices.
Last updated by Dražen 10 hours, 3 minutes ago.
Assisted by: Dražen.
Author | Posts |
---|---|
July 11, 2025 at 9:15 am #17226868 | |
arnoP-3 |
Background of the issue: Symptoms: Questions: |
July 11, 2025 at 9:37 am #17226961 | |
Dražen 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, and themes. You can access the WordPress dashboard using the link below: Try to replicate the issue with a simple example page. This will help us to report the probable issue to the compatibility team and solve the possible problem faster. Regards,
|
July 11, 2025 at 5:47 pm #17229168 | |
arnoP-3 |
Hi Drazen, I created a parent and child post. The child post points to the parent via the only custom field. The child post was translated, but the custom field of the German version remains empty. So, the English child points to the English parent but the German child does not point to anything. Can you see what's wrong here? Thanks, |
July 14, 2025 at 6:41 am #17231713 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello Arno, thanks for getting back, I checked but could not find a solution. I have escalated this to our 2nd tier to check and advise further. I will update here when I have some news. Regards, |
July 14, 2025 at 2:01 pm #17234308 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, so it seems to be a know issue that will be fixed in WPML 4.8, in the mean time you can use wpml_object_id hook and it should work fine. So here is an example of workaround and code used in sandbox test site: - Keep the custom field parent_post as COPY, that way the translation will always have a POST ID (even if it's not he translated one). We don't know how you are coding this field into your template, so we created an example on your sandbox to explain how to use wpml_object_id. We edited the theme single.php template: hidden link We added the following code right after get_template_part( 'template-parts/content/content-single' ); line 18. // TEST WPML // Getting selected post ID: $post_id = rwmb_meta( 'parent_post' ); ?> <p>Selected post ID (original EN ID): <?php echo $post_id ?></p> <?php $current_lang = apply_filters( 'wpml_current_language', NULL ); $post_id = apply_filters( 'wpml_object_id', $post_id, 'parent-post', TRUE, $current_lang ); ?> <p>Translated post ID: <?php echo $post_id ?></p> <p> Only to show it will work with default WP functions such as get_permalink or get_the_title: </p> <h3><a href="<?php echo get_permalink( $post_id ) ?>"><?php echo get_the_title( $post_id ); ?></a></h3> <?php The first part is to print the post ID selected (which will be the EN post ID) Then we use wpml_object_id to translate it in the current language We print again the post ID to show the difference Last we gave a real use case example To see it in action go to hidden link Hope this helps out, let us know if any further questions or doubts. Regards, |
July 14, 2025 at 5:19 pm #17235027 | |
arnoP-3 |
Hi Drazen, Thanks, I will give that a try. By the way, I am not coding the field. I use the Meta Box plugin to configure it, as well as custom post types. 1) Should the custom field be set back from COPY to TRANSLATE once this bug has been fixed? 2) What's the estimated release date of version 4.8? |
July 15, 2025 at 6:13 am #17236070 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, thanks, even if the field looks empty on 2nd language page, in DB the correct value is saved/ showed, it is only visible bug, and for frontend you should use suggested approach. 1) Yes it should always be set to copy, if translate then you need to do manual translation and adjust the field value manually. 2) We have it planned for few week, but I can not give any ETA. Regards, |
July 15, 2025 at 6:31 am #17236117 | |
arnoP-3 |
Yes, I found that the field is empty and read-only in the German translation. 1) If I understand you correctly, I should leave it at COPY even once the bug is fixed, but WPML will then correct the value for translated posts? 2) Thanks |
July 15, 2025 at 6:34 am #17236128 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, as I have said above, that is expected it will show empty in backend, but actually in database it contains correct value, it is visual bug. In such case and as plugin usage doc are explained you need to use PHP code to show field value on frontend, and for such we have provided workaround and how to use it and show correct translated post value. What you see empty in backed, is just a visual a bug and will be fixed in new WPML version. Regards, |
July 15, 2025 at 6:43 am #17236134 | |
arnoP-3 |
Ok, thank you. If I understand you correctly, I should leave it at COPY even once the bug is fixed, but WPML will then correct the value for translated posts? |
July 15, 2025 at 6:45 am #17236164 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, yes, I also advise you to check difference between each translation settings, and what it means translate, copy etc for future and other cases: - https://wpml.org/documentation/getting-started-guide/translating-custom-fields/ Regards, |