Great!
I've added only "OR" condition fot the edit section and it works!
Thank You very much!
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
add_action('cred_save_data','auto_titolo_fascicolo_frontend',30,2);
function auto_titolo_fascicolo_frontend($post_id,$form_data) {
if (($form_data['id']==374) OR ($form_data['id']==417)) {
$title ="";
// $rivista_id = toolset_get_related_post( $post_id, $relationship='wpcf-rivista-fascicolo' );
$rivista_id = $_POST['@rivista-fascicolo_parent'];
$rivista = get_the_title($rivista_id);
$anno_solare = get_post_meta($post_id, 'wpcf-fascicolo-anno-solare', true);
$numero_fascicolo = get_post_meta($post_id, 'wpcf-fascicolo-numero', true);
$title= $rivista . ' | ' . $anno_solare . ' | N. ' . $numero_fascicolo;
$args = array(
'ID' => $post_id,
'post_title' => $title,
'post_name' => sanitize_title( $title )
);
wp_update_post($args);
}
}

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Great - glad to help.
Please feel free to close the ticket.