Skip Navigation

[Resolved] Redirecting to parent post after submission of a child Cred form

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

Problem: When a user submits my child CRED form, I would like to redirect them to the parent post using cred_success_redirect, but it doesn't seem to work

Solution: You can access the parent post's ID from the child post using the "_wpcf_belongs_[parentslug]_id" meta value, so the correct code is:

$parent_id = get_post_meta( $post_id, '_wpcf_belongs_medewerker_id', true);

Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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 Jacques Spijkers 7 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#556945
Schermafdruk 2017-08-06 13.05.10.png
Schermafdruk 2017-08-06 13.03.45.png

I am trying to:

Redirect after submision of a child form tot the parten post

I'm using:

add_filter('cred_success_redirect_2360', 'redirect_to_parent', 10, 3);
function redirect_to_parent($url, $post_id, $thisform) {
$parent_id = get_post_meta( $post_id, 'medewerker', true);
return get_permalink( $parent_id );
}

After submitting the form of Jos Verkampen I want tot go back to the form (Tab?) of the parent 'medewerker'

Link to a page where the issue can be seen:

hidden link

I expected to see:

Instead, I got:

#557036

Hi, the parent ID associated with a child post is stored in the postmeta table as "_wpcf_belongs_[parentslug]_id", so you should be able to get that information using the following code:

$parent_id = get_post_meta( $post_id, '_wpcf_belongs_medewerker_id', true);
#557045

Christian.

Man thanks tot you. You've helped me again. I'm learning toolset by the day thanks to you.