Filters the redirect URL a contact is sent to after a successful v2 form submission.
apply_filters( 'groundhogg/form/v2/success_url', $url, $form );
You will receive the configured success URL string and the Form_v2 object.
Example
add_filter( 'groundhogg/form/v2/success_url', 'my_extension_dynamic_success_url', 10, 2 );
/**
* Redirect to a personalised thank-you page after form submission.
*
* @param string $url
* @param \Groundhogg\Form_v2 $form
*
* @return string
*/
function my_extension_dynamic_success_url( $url, $form ) {
$contact = \Groundhogg\get_current_contact();
if ( $contact && $contact->has_tag( MY_EXTENSION_VIP_TAG_ID ) ) {
return home_url( '/vip-thank-you/' );
}
return $url;
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
