Custom Field trasnlation with Polylang Pro
- This topic has 5 replies, 2 voices, and was last updated 27 seconds ago by
Peter.
-
AuthorPosts
-
October 7, 2025 at 9:36 PM #49098
webdev
ParticipantHi,
I have the following code to register custom fields for translation (copied directly from the MetaBox code generator):<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'post_types' => ['chart-mapping'], 'translation' => 'advanced', 'title' => __( 'test mapping fields', 'your-text-domain' ), 'id' => 'test-mapping-fields', 'fields' => [ [ 'type' => 'textarea', 'id' => $prefix . 'translateable', 'name' => __( 'translateable', 'your-text-domain' ), 'translation' => 'translate', ], [ 'type' => 'text', 'id' => $prefix . 'untranslateable', 'name' => __( 'untranslateable', 'your-text-domain' ), 'translation' => 'copy', ], ], ]; return $meta_boxes; }
The option 'translation' => 'translate' does not work correctly in the textarea field, and always behaves in the same way as a 'copy'.
Note this is the same if the top-level option is set to 'translation => 'translate' instead of 'advanced' as well.Is this a bug or am I doing something wrong?
October 8, 2025 at 10:08 PM #49110Peter
ModeratorHello,
The option 'translation' => 'translate' does not work correctly in the textarea field, and always behaves in the same way as a 'copy'.
When you create or edit a translation post, if you add the translation field value, difference from the original field, after saving the post do you see the same value as the original?
October 9, 2025 at 4:24 PM #49118webdev
ParticipantI have text in the field, eg:
'My text in language 1'
I create a translation:
The text in the field reads:
'My text in language 1' <-- this is correct so far
I change the text in the translation to:
'My text in language 2' <-- create a translation
Save the translation.
When I go back to the original, it reads:
'My text in language 2' <-- showing the translated text where it should show the original
If I change it back to the original text then the translation also changes, ie both the translation and the original are always the same (as in a 'copy')
October 9, 2025 at 8:49 PM #49123Peter
ModeratorHello,
For the
text
field withcopy
setting, I see it works properly. The copy action means this field value is synchronized between the original post and its translation. It doesn't mean only copying from the original post.October 10, 2025 at 2:55 AM #49126webdev
ParticipantYes, correct, the 'copy' setting behaves like that... but the 'translate' setting behaved exactly the same...
As it happens, I've uninstalled Polylang for this project and am using WPML, as there were some errors showing up in Settings forms, so I won't be able to test any more anyway...October 11, 2025 at 8:37 AM #49130Peter
ModeratorHello,
I don't see the issue with "translate" setting on my site, please check this screen record https://drive.google.com/file/d/1gKr9ZbJAi2LWQ8J56Qe5Xv19Sef6NHfM/view?usp=sharing
Let me know if you have any questions when using Polylang with Meta Box.
-
AuthorPosts
- You must be logged in to reply to this topic.