Update post title/name with a Date taken from a types Date CF (and obviously you won’t 2664748859 as title but 11-06-2014 or similar) with CRED hook. Remember that Toolset uses Timestamp but you want a “normal” date as Post Title.
function ttd_save_data_action($post_id, $form_data){ // Change your CRED Form "ID" accordingly below if ($form_data['id']==ID){ //Declare the content of your variables, change "your_custom_field_slug" accordingly $custom_value = get_post_meta( $post_id, 'wpcf-your_custom_field_slug', true );//get posts' Date field value (timestamp) $custom_title = gmdate("m-d-Y", $custom_value);//convert timestamp to m-d-y for output //collect data and define new title $my_post = array( 'ID' => $post_id, 'post_title' => $custom_title, 'post_name' => $custom_title, ); // Update the post into the database wp_update_post( $my_post ); } } add_action('cred_save_data', 'ttd_save_data_action',10,2);
Let us know if this snippet is not working for you:
This snippet doesn’t work