I have tried the same codes you mentioned above in my localhost, it works fine, please check these in your website:
1) Make sure you are using the latest version of Toolset plugins, you can download them here: https://toolset.com/account/downloads/
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again
4) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL, I need to test and debug it in my localhost, thanks https://toolset.com/faq/provide-supporters-copy-site/
I have tried your custom PHP codes in my localhost, it works fine in my theme file "functions.php", please make sure you have put it in your theme file "functions.php", and test again
As I mentioned above, it works fine in my localhost, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here: https://toolset.com/account/downloads/
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate other custom PHP snippets, and test again
Please provide a full copy of your website in below private message box, also point out the problem page URL and form URL, where I can edit your PHP codes, thanks
You can see the posts here - /wp-admin/edit.php?post_type=vehicle
The cred is here - /wp-admin/post.php?post=8712&action=edit&classic-editor
The form is here - /add-car/
The results display on the home page and here - /garage-counts/ (BTW - you can see that because it stopped working there is a test post missing the 'vin' because it pulls from the title)
This might just be something silly that I missed. But I tried redoing it several times.
I tested the form and noticed that the ID of the post selected in the "Vehicle Location" field is correctly being used to create the new post's title.
( please check the newly created Vehicle post "6927" )
As for the Vin part, that is not being included in that title, that is due to another function, in the theme's "functions.php" file
add_action('cred_save_data', 'copy_location_to_multiline_field',10,2);
function copy_location_to_multiline_field($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==8712)
{
if (isset($_POST['wpcf-vehicle-location']))
{
// add it to saved post meta
update_post_meta($post_id, 'wpcf-vin', $_POST['wpcf-tmna-location']);
}
}
}
This function sets the empty value to the "wpcf-vin" field, as this form has no "wpcf-tmna-location" field.
As a result, when the "build_vin_title" executes the "wpcf-vin" field already has the empty value set and so no vin is included in the title.