Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement