Problem: I would like to use a Form to edit a repeatable field group (RFG). After the Form is submitted, I would like to redirect to the parent post.
Solution: Use this custom code snippet to redirect to the parent post. Be sure to set your Form to redirect to some custom page.
add_filter('cred_success_redirect', 'custom_redirect_rfg_editor',10,3); function custom_redirect_rfg_editor($url, $post_id, $form_data) { if ($form_data['id']==12345) $writer = toolset_get_related_post( $post_id, 'your-rfg-slug' ); return get_permalink($writer); return $url; }
Replace 12345 with the numeric ID of this Form, and replace your-rfg-slug with your actual RFG slug.
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_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.
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 |
---|---|---|---|---|---|---|
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 2 replies, has 2 voices.
Last updated by 6 years ago.
Assisted by: Christian Cox.