Problem:
2 CPTs: book, reco-book and book is parent of reco-book
1 CRED form to create a new reco-book positioned on the book post
I am trying to use cred_save_data to record the book parent post id of the reco-book post created through the form into a repeating custom user field named recommended-book-ids.
Solution:
Please use this updated code:
add_action('cred_save_data_160', 'jln_add_book_id',10,2); function jln_add_book_id($post_id, $form_data) { $user_id = get_current_user_id(); $parent_id = get_post_meta($post_id, '_wpcf_belongs_book_id', true); add_user_meta($user_id, 'wpcf-recommended-book-ids', $parent_id); }
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 |
---|---|---|---|---|---|---|
- | 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, 2 months ago.
Assisted by: Noman.