Skip to content

Instantly share code, notes, and snippets.

@gicolek
Created March 4, 2015 15:54
Show Gist options
  • Save gicolek/646914bae8eeeefce75b to your computer and use it in GitHub Desktop.
Save gicolek/646914bae8eeeefce75b to your computer and use it in GitHub Desktop.
Hook Gravity Forms confirmation and redirect the user - http://wp-doin.com
<?php
add_filter( "gform_confirmation_3", "cc_confirmation_redirect_1_3", 3, 4 );
/**
* Redirect the visitor on successful form submission
* @hook gform_confirmation
*/
function cc_confirmation_redirect_1_3($confirmation, $form, $lead, $ajax) {
// lets reference and sanitize the first entry field, the id corresponds to the field id from the form
$param = esc_attr( $lead[1] );
// let's construct the url get parameters
$params = array( 'param' => $param );
// let's get our url
$url = 'http://example.com';
// redirect the visitor
wp_safe_redirect( add_query_arg( $params, esc_url( $url ) ) );
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment