Problem:
I have:
parent post type: "contatto"
child post type "corso"
custom field "data-inizio corso" in child "corso"
custom field "data-ultimo-corso" in parent "contatto"
I would like that when filled "data-inizio-corso" the value is copied in "data-ultimo-corso" updating or creating the post.
Solution:
Types plugin is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example, if the parent post type is using slug "contatto", then in single child "corso" post, there is a hidden field "_wpcf_belongs_contatto_id", the filed value is parent post ID, so if "$post_ID" is a child "corso" post ID, you can get the parent "contatto" post ID with PHP codes:
$contatto_id = get_post_meta($post_ID, '_wpcf_belongs_contatto_id', true);
Then use the $contatto_id to update the custom field "data-ultimo-corso" to what you want.
Relevant Documentation:
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 |
---|---|---|---|---|---|---|
- | 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 3 replies, has 2 voices.
Last updated by Luo Yang 5 years, 2 months ago.
Assigned support staff: Luo Yang.