Tell us what you are trying to do?
I want duplicates to be made in the second language (English) each time a user submits the form. The thing is that I've already done it a while ago, and I don't remember how I did it!!
What is the link to your site? hidden link
This is the form that actually duplicates in English the location posts when submitted
I'd like to do the same with other CPT, but I don't remember what I've done! hahah
I finally found my code. It was in the child theme function file.
2 questions:
1) Best practices are to put in into the child theme file or the Toolset Custom Code tab? Or both are good?
2) Can I add multiple forms in the same code or I need one custom code by form? ($forms = array(20129, CPT1, CPT2, CTP3 ???);
Thanks!
// Automatically generate translation duplicates on posts created with a Toolset Form
function quick_duplicate_save_data_action($post_id, $form_data)
{
// Edit form ID(s)
$forms = array(20129);
if (in_array($form_data['id'], $forms)) {
global $sitepress;
// make translated duplicates
do_action('wpml_make_post_duplicates', $post_id);
2 questions:
1) Best practices are to put in into the child theme file or the Toolset Custom Code tab? Or both are good?
==>
Both are good. But it depends on your choice. If you change the theme, you will have to move the code as well but Toolset "Custom Code" will offer you flexibility in that case.
2) Can I add multiple forms in the same code or I need one custom code by form? ($forms = array(20129, CPT1, CPT2, CTP3 ???);
==>
Yes, you can add more form IDs to that $forms array.