[Résolu] Custom field – edit in original language doesn't update value in the translation
This support ticket is created Il y a 6 années et 8 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
When using the CRED form to update the value, it saves the new value in the original language version. lien caché
But on the translated version it doesn't update. lien caché
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.
lien caché
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 );
}
}
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Paul
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.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Paul
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.