Tell us what you are trying to do?
I want to display the ID of the submitted form, the name as well as the subject of the submit field content of the custom Toolset contact form I created.
I managed to get the ID to show in the list of submitted contact forms in the back-end using a custom script to be used in the functions.php I found in one of the support replies. But could not make it work for the submit text to be shown:
// Toolset contact form
add_action('cred_save_data','contact_title', 10, 2);
function contact_title($post_id, $form_data) {
// if a specific form
if (($form_data['id']==790)) {
$type = get_post_type($post_id, $form_data);
if ($type == 'contact-form')
{
$subject = get_post_meta($post_id, 'subject-contact', true);
$key = $post_id . ' - ' . $subject;
$slug = sanitize_title($key);
wp_update_post(array('ID' => $post_id, 'post_title' => $key, 'post_name' => $slug));
}
}
}
Is there any documentation that you are following?
I could not find one.
What is the link to your site?
hidden link or hidden link
Hello,
How do you setup the custom field "subject-contact"?
If it is created with Types plugin, Types plugin will pre-pend string "wpcf-" before field slug, so in database, the real field slug is:
wpcf-subject-contact
You can try to replace this line of your PHP codes from:
$subject = get_post_meta($post_id, 'subject-contact', true);
To:
$subject = get_post_meta($post_id, 'wpcf-subject-contact', true);
And test again.
My issue is resolved now. Thank you!