Problem: It seems that a new Child Form on the parent post page does not properly assign the parent post. The parent appears to be selected, but not saved.
Solution: There is currently a known issue where new child post forms displayed on a page with a Layout are not assigning parents correctly. The following code snippet will work around the issue until a fix is ready:
add_action('cred_save_data', 'toolset_fix_layout_relationship_bug',10,2); function toolset_fix_layout_relationship_bug($post_id, $form_data) { // one array for each form $hash = array( array( 'id' => 282, 'slugs' => array('profile-service'), ), ); // closure to find the matching array hash item and slug $find = function( $var ) use ($form_data) { $el = ($var['id']==$form_data['id']); return $el; }; // create an array of form IDs where you want to apply this code $forms = array_column( $hash, 'id' ); if ( in_array( $form_data['id'], $forms ) ) { // find the slug array in the matching hash item and use it to connect the parent post $thisHash = array_filter( $hash, $find ); $slugs = $thisHash[array_keys($thisHash)[0]]['slugs']; foreach( $slugs as $slug ) { $parent_id = $_POST['@' . $slug . '_parent']; $parent = toolset_connect_posts( $slug, $parent_id, $post_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 |
---|---|---|---|---|---|---|
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 6 replies, has 2 voices.
Last updated by 5 years, 11 months ago.
Assisted by: Christian Cox.