[Resolved] Custom field – edit in original language doesn't update value in the translation
This support ticket is created 6 years, 8 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
When using the CRED form to update the value, it saves the new value in the original language version. hidden link
But on the translated version it doesn't update. hidden link
Incidentally, if I were to THEN update the "description" field of the original language version, the description AND the correct mileage number gets updated on the translated version.
wpcf-mileage is set to "Copy" but it obviously doesn't copy.
hidden link
fwiw I had a similar issue with the "Feature Image" not being copied to the translation version when an Ad was posted.
Your support staff Minesh solved by adding this:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data){
// if a specific form
if ($form_data['id']==6350){
do_action( 'wpml_make_post_duplicates', $post_id );
}
}
I'm not sure that code is very helpful when editing posts rather than creating them.
I set up a test site locally and can see that when I edit the post in the backend the updated custom field is copied to the translated post, but if I do the same with a CRED form it is not.
I'm escalating this so it can be investigated further to check whether we have a bug or a missing feature here, and to see if there is a solution I can give to work now.
I have just been discussing it with colleagues. It looks like the WPML API has been updated. It is recommended you include the following with the cred_save_data hook, much like your example code above:
It has not yet been decided whether this should happen automatically within CRED, in case there are circumstances where a user would not want it to happen.