Problem:
In a Parent/Child Post relationship, is it possible to update an attribute (or more) on the parent post when submitting new content for the child post via a CRED form?
Solution:
Please modify and add following code in your theme’s or child theme’s functions.php file:
/* Update Parent Field on Child Post creation */ add_action('cred_save_data', 'update_parent_field_on_child_creation',10,2); function update_parent_field_on_child_creation($post_id, $form_data) { // if a specific form if ( $form_data['id'] == 2448 ) { $parent_id = get_post_meta($post_id, '_wpcf_belongs_property_id', true); // property = your parent post type name update_post_meta($parent_id, 'wpcf-status', 'closed'); // wpcf-status = your field name // closed = your field new value } }
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 |
---|---|---|---|---|---|---|
- | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | - |
- | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
This topic contains 2 replies, has 2 voices.
Last updated by 7 years, 4 months ago.
Assisted by: Noman.