Skip Navigation

[Closed] redirect to parent post after submission

This support ticket is created 7 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 7 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#394029

I am trying to: redirect to parent post after child submission.

I visited this URL: https://toolset.com/forums/topic/child-form-redirect-to-parent-on-submission-2/ , https://toolset.com/forums/topic/child-form-redirect-to-parent-on-submission/

Instead, I got: nothing happens....

hi,
i tried the above solutions and it's not working for me...
could you please help me?
my parent post type is called "protocol"
my cred form id is 43/

this is my code:

add_filter('cred_success_redirect_43', 'redirect_to_parent', 10, 3);
function redirect_to_parent($url, $post_id, $thisform) {
  $parent_id = get_post_meta( $post_id, '_wpcf_protocol_id', true);
  return get_permalink( $parent_id );
}
#394087

Dear shirlyk,

If you are using Types plugin to setup the parent/child post type relationships, the custom field slug should be this:
_wpcf_belongs_[parent-slug]_id
See our document:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
section "Displaying child posts using Types PHP functions"

In your case, I suggest you try with:

...
$parent_id = get_post_meta( $post_id, '_wpcf_belongs_protocol_id', true);
...
#394237

thank you for the explanation, but it's not working for me.

after adding the code to my function.php file- is there any other changes i need to do?
does this code "bypass" the cred default action after sending the form? (as i specified when creating the cred):?

#394443

Since it is a custom codes problem, please duplicate same problem in a test site, and fill below private detail box with login details and ftp access, also point out the problem page URL and CRED form URL, and where I can edit your PHP codes, I need a live website to test and debug it. thanks

The topic ‘[Closed] redirect to parent post after submission’ is closed to new replies.