Problem: I have a Form that allows Users to create child posts. The Form contains a select field that allows the User to select a parent post in a one-to-many relationship. Instead of displaying the parent post title in each select field option, I would like to display the post ID. Or, I would like to automate the parent post title so that the title is the same as the post ID. Parent posts are also created by Forms.
Solution: If you want to automatically set the parent post's title to be the same as its ID you could use the cred_save_data hook with your parent post Form. Remove the title field from the parent post Form first to prevent the User from submitting a title. Then use the cred_save_data hook and the wp_update_post API to programmatically set the post title.
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
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.
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 4 years, 9 months ago.
Assisted by: Christian Cox.