Skip Navigation

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 12 replies, has 2 voices.

Last updated by Andreas W. 2 months, 1 week ago.

Assigned support staff: Andreas W..

Author Posts
July 15, 2021 at 6:52 pm #9211943

mashaB

Tell us what you are trying to do?
Translate custom fields

Is there any documentation that you are following?
hidden link
https://wpml.org/documentation/getting-started-guide/translating-custom-fields/

Hi!

We use Meta Box plugin. We set up several custom fields which are saved in custom DB tables. Added values to them as per instructions. However, WPML does not register those fields for translation.

Could you please help?

Thanks!

July 16, 2021 at 2:50 am #9213325

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Did you make sure to mark the fields as translatable at WPML -> Settings -> Custom Field Translation?

This taks is explained in the section:
Step 3: Set up WPML plugin to translate custom fields
hidden link

If this still will not solve the issue, please provide admin access to the site after taking a complete backup of website and database.

The private reply form is enabled.

Best regards
Andreas

July 16, 2021 at 11:03 am #9216763

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

In order to translate the Fields, the Field Groups need to be marked as translatable here as well.

You will be now able to translate the fields at Meta Box -> Custom Fields.

Then translate each article with the WPML Translation Editor as I did for this one:

hidden link

Also make sure to use the WPML Translation Editor when translating the fields.

Inside the WPML Settings I have set all Meta Box Custom Post Types now as "Translatable - only show translated items" as I would suggest you first translate this way and only enable the "Translatable - use translation if available or fallback to default language" after you have done some translations.

In case the fallback option might not work as expected we will need to revise this again, but take note that you will only need thios option in order to show the original English Custom Fields and Custom Posts on other languages if a translation does not exist.

Let us know if further assistance is needed.

Best regards
Andreas

The WPML Translation Editor can get enabled in the right sidebar of the WP Page Editor. A dialog will let you devide to enable it for the current post, all posts of the same type or all site content.

July 16, 2021 at 2:23 pm #9217917

mashaB

Thanks, Andreas! The issue is not with custom post types, but with custom fields which are stored in custom tables. They do not appear on WPML settings page at all to configure translation. Custom post type have no issues so far and fall back works as expected based on my testing.

In your test I do not see you used any of the custom fields I mentioned.

July 17, 2021 at 12:11 am #9219737

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Custom Fields are declared at Meta Box -> Custom Fields and are now also translatable there.

The setting for making them translatable is found on the bottom of each Custom Field Editor page or at WPML -> Settings -> Post Type Translations -> Field Groups (meta-box).

Could you please test the translations now? See screenshot.

Once the field groups are translated, then the fields should show up for translated articles in the right sidebar of the WordPress Editor.

In case I still did not capture the issue please provide more details and screenshots.

Best regards
Andreas

custom fields.JPG
July 17, 2021 at 1:29 am #9220177

mashaB

Thanks for your suggestion, Andreas, but this setting does not enable translation for actual values entered via these fields, but only for those fields labels and slugs - Meta Box data, not user entered data - which is not the intention here. You can check a test article post I added where I filled in custom fields.

The expected behavior after adding those values will be to see those custom fields listed under Custom Fields Translation section in WPML settings, but WPML does not see them.

Screenshot 2021-07-16 182115.png
July 17, 2021 at 2:03 am #9220349

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Yes, indeed. I see the issue.

Now, the field "vob_subtitle" actually is part of the page content and has a setting at WPML -> Settings -> Custom Field Translation which I have now set to "translate" and it appears on the WPML Translation Editor.

Those Custom Fields are "Taxonomy Advanced" type which seems not to be translatable with the WPML Translation Editor.

I can offer that we try to recreate this on a test-site and escalate towards our compatilbity team, but in fact translating those fields manually on each posts might also solve the issue. This is why I suggested translating the filed for which I have now created a duplicate on German.

Please let me know if this is a proper solution or if I should provide a test-site for recreating the issue.

Best regards
Andreas

translate fields.JPG
July 17, 2021 at 2:40 am #9220699

mashaB

Yes, we have found this workaround but it is not scalable for as as we support 9 languages, use an external translation service and produce 2-3 posts a day. It is also holding us from completing other customization parts.

What is interesting is that WPML returns those values correctly in the corresponding language once translated directly inside the post so it knows how to find the correct translation, but it is just not seeing them.

I would be more than happy to assist with a reproducible case.

July 17, 2021 at 3:49 am #9221125

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

You are using the custom taxonomy "Source Name Tag" which then filters the field on each article.

As WPML can find this custom taxonomy inside Meta Box and realized that this taxonomy is linked to this field we can translate it at WPML -> Taxonomy Translation and when selecting an option on an article. Then WPML will apply the taxonomy translation to the translated article automatically as soon the article is translated.

The other custom fields of this Meta Box field group called "Source Name", "Source URL", and "Journalist/Author" somehow are not showing up anywhere inside the translation options. Besides, they appear in the right sidebar and usually the WPML Translation Editor will not translate any content that appears in this section as here we would usually use WPML -> Taxonomy Translation.

Maybe another solution for this issue would be to use a different field group for these fields, as you did for "subtitle", which is translatable and is one that does not inlcude a taxonomy, because it seems as to me that this seems to be the cause of the issue.

In order to troubleshoot and escalate this issue I have already created a test site here:

One-Click-Login:
hidden link

If you could please try to recreate the issue here and leave me a short message once this is done?

Please also try to take my advises. In fact, WPML by default will not translate custom taxonomies inside the WPML Translation Editor.
https://wpml.org/documentation/getting-started-guide/translating-post-categories-and-custom-taxonomies/

You might need to try to solve this while using a field group for custom taxonomy fields, and another field group for fields that is not based on a Taxonomy, and it could be that our compatilbity team might suggest the same, if a applicable workflow can lead to a solution.

We can surely try to tes this on our test-site, if you wish.

Best regards
Andreas

July 17, 2021 at 4:59 am #9221285

mashaB

These fields are saved in custom tables as specified in issue description. Subtitle custom field is not using custom tables to save values and it works as expected along with other fields saved that way.

Saving custom fields in custom table is a common feature provided by many customization plugins. Meta Box is not different here.

Custom taxonomy from that fields group is not being applied/translated either though we have set translation for all tags there so at least the are being pulled it to select in all languages. You still need to go to an article in a target language and select the tag and save. Please note that we have translated those taxonomies via WPML Taxonomy Translate feature.

Where custom field appears it is just a setting with custom fields. You can put subtitle custom field there as well and see it will be translated.

July 17, 2021 at 5:29 am #9221335

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

In order to troubleshoot and escalate this issue I have already created a test site here:

One-Click-Login:
hidden link

If you could please try to recreate the issue here and leave me a short message once this is done?

Best regards
Andreas

July 17, 2021 at 5:33 am #9221353

mashaB

I have created taxonomy and fields in the demo site, they are now available for posts to use. Please note that you need to create tables in DB with matching fields to make sure values are saved in DB. Code added to functions.php should give enough information to do it.

I appreciate your help to find a solution.

July 17, 2021 at 7:12 am #9221461

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

At the moment I do have translation settings for all registered fields and they are further translatable with the Advanced Translation Editor (ATE).

You did not recreate the exact issue that we see on your site and I also do not find any problem on the test-site until now when it comes to translations.

I did not create any custom tables so far and I would kindly ask you to do that, as we need to know exaclty how the issue was created. Please apply the same procedure that you used on your site but also take note that MetaBox actually has the following suggestiosn for this task:

As far I see Meta Box has a plugin for creating custom tables:
hidden link

They further provide the following documentation:
hidden link

Further I can see your site uses hidden link which is currently not installed on our test-site.

Could you please keep testing and let me know if you can recreate the same issue on our test site? Also please provide exact details about what code has been added and where.

Further, when using custom tables, it is quiet expected that WPML is not aware about that those tables exists whithout letting it know about them. This could usually be considered custom work and I do not believe that we could provide a general solution for such issues, but I can consult our second tier support team on this behalf.

We are providing on this behalf the following developer documentations:
https://wpml.org/documentation/support/
https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

We cannot support or produce custom code solutions for you. When you need custom coding which extends WPML functionality, we recommend using our WPML certified contractors system.
Source:
https://wpml.org/purchase/support-policy/

Best regards
Andreas

The topic ‘[Closed] WPML does not register custom fields saved in custom tables for translation’ is closed to new replies.