Skip Navigation

[Resolved] Custom fields not updating if value is blank in original language (WPML)

This support ticket is created 4 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by sueL-2 4 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1897079

I am trying to: update a page with Types custom fields that has been translated in WPML

Link to a page where the issue can be seen: hidden link

I expected to see: the updated custom field value, after saving the page - for example, on this page there should be an image on the left hand side of the section with title "FOGLI PRESENZE ONLINE". (field id: wpcf-block-1-image)

Instead, I got: a blank value for any custom field that has a blank value in the original language (English). This is the page in the original language, which doesn't have a value for wpcf-block-1-image: hidden link

In the custom field options, Translation preferences is set to "translate" and this has worked fine for many years. The problem has emerged in the last month or so, i.e. presumably related to a recent WordPress or WPML/Toolset update.

As this is related to WPML, I will also create a support ticket there and reference this one.

I can provide access to a development site if required.

#1898243

Hi,

Thank you for contacting us and I'd be happy to assist.

I couldn't access the admin area, as the login page itself was behind password protection, but if you'd like to keep the custom field values in sync between the translations, the correct option would be "Copy" and not "Translate".
( ref: https://wpml.org/documentation/getting-started-guide/translating-custom-fields/ )

The "Translate" option should be used, when you need to manage the custom field values independently across the translations.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1898573

Hi Waqar

Thanks for getting back to me.

In this case, it's definitely the "Translate" option we need, as we want the field values to be translated and NOT kept in sync. However, since updating to WP5.6 (and updating Toolset/WPML), it is behaving as if set to "Copy" - but ONLY if the field in the original language is blank/empty.

I've set up a page on our development site to demonstrate the problem:

English (Original) - hidden link
Spanish (Translation) - hidden link

This is a simple page with the following custom fields:

block-1-content
block-1-image
block-2-content
block-2-image

Steps to replicate the problem:

1. Update block-1-image on the ES translation. As long as there is a value in the EN original, it will behave as expected ("Translate").

2. Update block-1-image on the EN original. Again, behaviour is as expected. We can update the original image without it affecting the translation ("Translate" and NOT "Copy").

3. Delete the value for block-1-image on the EN original so the field is blank/empty. The image is removed from the ES translation. This is behaving as "Copy" and NOT "Translate" as it should be. NOTE this is only since WP5.6.

4. Now try to update the value for block-1-image on the ES translation. So long as the EN original field is blank it is not possible to populate the translated field. Again this is incorrect behaviour and is only since WP5.6.

Note that this also applies to any of the custom field types, it is not an image translation problem.

I hope I've explained this clearly but please let me know if you want me to screencast an example. I've removed the password protection from the dev site so you should be able to access it now.

Hope to hear back from you soon,

James

#1899381

Hi again Waqar,

The problem seems to be related to something that has changed in WPML since version 4.4.3, possibly the following change made in version 4.4.4:

"Added the ability to remove a custom field from post translations when it's removed from the original post and the field translation setting is set to Translate."

I've started a thread on the WPML forums and have managed to replicate the issue in their sandbox environment.

https://wpml.org/forums/topic/types-custom-fields-not-updating-correctly-on-translated-pages-wpml/#post-7806033

I hope you can work with the WPML dev team to help us find a solution.

Many thanks,

James

#1900791

Hi James,

Thank you for sharing these details and I'm currently performing some testing and research around this.

I'm also in touch with the colleagues on the WPML side and we'll keep you updated through this ticket.
( ref: https://wpml.org/forums/topic/types-custom-fields-not-updating-correctly-on-translated-pages-wpml/ )

Thank you for your patience.

regards,
Waqar

#1901161

Thank you for waiting and I was able to reproduce this behavior on my test website too.

Your observation is correct and it is a result of some changes introduced in WPML 4.4.4 and is already under review.

You're welcome to mark this Toolset forum ticket as resolved and we'll keep you updated through the WPML forum ticket.
( ref: https://wpml.org/forums/topic/types-custom-fields-not-updating-correctly-on-translated-pages-wpml/ )

#1901171

Thanks for your help. As requested, closing this support ticket and will check for updates on the WPML forum.