Problem:
I want to do is use one of the CRED API hooks after the form is submitted to add a meta value to the corresponding post.
Solution:
Yes, you are right, you can use CRED action hook "cred_save_data" to update/add custom field to the post, see the document you mentioned above:
https://toolset.com/documentation/programmer-reference/cred-api/#csd
But, it needs custom codes, for example, when user submit the CRED form, the post is saved into database, you can use hook "cred_save_data" to trigger a custom PHP function, in this function, you need to:
1) get the value of "URL of the video uploaded", if it is a custom field created with Types plugin, you can use Types function types_render_field() to get the field value:
https://toolset.com/documentation/customizing-sites-using-php/functions/
Or you can use WordPress function get_post_meta() to get the value:
https://codex.wordpress.org/Function_Reference/get_post_meta
2) use above value to update/add it to the "meta value", for example
https://developer.wordpress.org/reference/functions/update_post_meta/
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#csd
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 |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
This topic contains 6 replies, has 2 voices.
Last updated by 6 years, 7 months ago.
Assisted by: Luo Yang.