Problem: I would like to use a unique number as the title and URL slug of all posts created by a CRED form.
Solution: Use the cred_save_data hook to update the post with the correct information:
add_action('cred_save_data', 'auto_title_action',10,2); function auto_title_action($post_id, $form_data) { $forms = array( 123, 456 ); // if a specific form if ( in_array( $form_data['id'], $forms ) ) { $my_post = array( 'ID' => $post_id, 'post_title' => $post_id, 'post_name' => $post_id ); // Update the post in the database wp_update_post( $my_post ); } }
Replace 123, 456 with a comma-separated list of forms where this automatic title should be applied.
Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://codex.wordpress.org/Function_Reference/wp_update_post
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 7 years, 1 month ago.
Assisted by: Christian Cox.