Hi there,
I'm trying to setup a redirection to previous post on form submit. I guess I need to use a custom hook for this? I see in the docs there's an example -
//This filter can also be applied for a specific form, using the form ID:
add_filter('cred_success_redirect_12', 'custom_redirect_for_form_with_id_12', 10, 3);
function custom_redirect_for_form_with_id_12( $url, $post_id, $form_data )
{
$newurl = 'hidden link';
return $newurl;
}
The form in question is a child edit form(CPT comment) and it's parent id (CPT member) is parsed from the previous post. So I want to know how I can use this parent ID in the webhook to redirect it back after form submit?
No not parent post id but it does have the comment title in the url.
e.g. hidden link
Within the form I have a hidden field set as:
Default slug: @member-comment.child
Default field value: [wpv-post-id]
The url to the form is a link with a parent member loop using this shortcode:
[toolset-edit-post-link content_template_slug='edit-comment' target='self']Edit comment[/toolset-edit-post-link]
Thank you so much I really appreciate your help!
I notice the form_data ID in the code is for the New comment form not the Edit comment form? I changed the ID to 434 but either way it's not actually redirecting me after submit. Did it work for you?
The problem that we are encountering now is that there isn't a way for me to get the parent id unless you've added the relationship field to the edit form.
I can go ahead and do this and then restructure the code to work with the parent field but please let me know if this is ok.
Thank you Shane.
The member id is in the url after forum submit but the redirect still doesn't work properly. It doesn't redirect to single member but all members.
Is this because id and not slug in the url? hidden link.