[Resolved] Select parent field using generic form generic select and connect parent

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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

This thread is resolved. Here is a description of the problem and solution.

How to assign parent post while creating child post using CRED generic field.

Using CRED hook: cred_save_data you can save the generic field "_wpcf_belongs_schools_id" value.

You can find the proposed solution with the following URL:
=> https://wp-types.com/forums/topic/select-parent-field-using-generic-form-select/#post-526080

Relevant Documentation:
=> https://wp-types.com/documentation/programmer-reference/cred-api/#csd

Related documentation: CRED Forms for Child Content

This topic contains 2 replies, has 2 voices, and was last updated by  Greig Neilson 4 months, 1 week ago. The support staff assigned to this topic is Minesh.

Viewing 3 posts - 1 through 3 (of 3 total)

I have a CRED form that I'm using to create a post and in doing select a parent. The child post is an Application and the parent post is a School.

The form field relies on a view which selects the post_id and the school name from another CPT. I know these are working because I can display them on the form the post id and name are correct.

Here's my code to select the parent:

[cred_generic_field field="_wpcf_belongs_schools_id" type="select" class="" urlparam="" value=""]
"options":[[wpv-view name="select-enrolment-schools"]]

The post saves correctly but fails to establish a relationship to the parent.

Thanks in advance for your help 🙂


Forum moderator

Supporter languages: English (English )

Supporter Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you need to use CRED hook: cred_save_data to save the generic field "_wpcf_belongs_schools_id" value.

You need to use WP standard function update_post_meta. For example:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
    // if a specific form
    if ($form_data['id']==9999)
        if (isset($_POST['my_custom_field']))

           $school_id = $_POST['_wpcf_belongs_schools_id'];
            // add it to saved post meta
            update_post_meta($post_id, '_wpcf_belongs_schools_id',$school_id);

- Replace 9999 with your original CRED form ID.

More info:
=> https://wp-types.com/documentation/programmer-reference/cred-api/#csd


Worked perfectly, thanks Minesh 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

Known issues and their solutions

We document known issues and their solutions in Toolset erratas. Save time by checking there first and seeing if what you are facing is a known issue. This list is kept short. We do our best to resolve all known issues with every release of Toolset plugins.

Support Policy

Toolset staff will help you use the Toolset plugins correctly, provide any information you need, help troubleshoot problems and advice on best-practices.

Please make sure to issue only one topic per each support ticket.

For more information, read our full Customer Support Policy.

Need custom programming work for your site? Check out our certified partners.