Problem: I would like to create a post with a title generated from its custom fields.
Solution: You can do this at 2 places, both times you will need to apply Custom Code.
1. In the backend when you create or edit a Post with WordPress.
Here you will use WordPress API "save_post" to update your Post Title with the values you have set in the Post Custom Fields.
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
2. In the Front End when you create or edit a Post with Toolset Forms.
Here you will create a Toolset Forms that either creates or edits those posts, and includes the Fields, but not the Title.
The user of this Form will fill out the Fields, and submit the Form.
You will hook a Custom Code to the Toolset Form's API "cred_save_data()" hook, which takes the values from those fields, and updates the Post Title with it.
A simple function example that does this, crafted using this DOC (https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
), is visible here:
https://pastebin.com/2BTbVbcs
Relevant Documentation:
https://developer.wordpress.org/reference/functions/get_post_meta/
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.
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 4 replies, has 3 voices.
Last updated by 6 years, 3 months ago.
Assisted by: Christian Cox.