Created
March 4, 2015 15:54
-
-
Save gicolek/646914bae8eeeefce75b to your computer and use it in GitHub Desktop.
Hook Gravity Forms confirmation and redirect the user - http://wp-doin.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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