Hi,
when saving the input/edit form I'd like to automatically set the post title from a custom post field value named (slug) "titolo-priorita". How can I do?
I've tried to apply this hook in Toolset/Settings/Custom code:
// Put the code of your snippet below this comment.
// AGGIORNA TITOLO DOC PRIORITA
add_action('cred_save_data','func_custom_post_title',10,2);
function func_custom_post_title($post_id,$form_data) {
if ($form_data['id']==346) {
$field_1 = $_POST['wpcf-titolo-documento']
$args = array('ID' => $post_id, 'post_title' => $field_1);
wp_update_post($args);
}
}
But it's not working and it gives me this error:
syntax error, unexpected '$args' (T_VARIABLE) in /var/www/html/pand-dpa.it/wp-content/toolset-customizations/set-post-title.php on line 15
A problem occurred when executing snippet "set-post-title-priorita". The result of include_once is: ""
Note: Depending on the nature of the error, you may need to run the script in a particular scenario to make sure the issue is gone.