Last active
June 14, 2019 11:22
-
-
Save Shelob9/26d389c475549929a49eab5e02aa8cb7 to your computer and use it in GitHub Desktop.
Example code for the Caldera Forms caldera_forms_submit_return_redirect filter, see: https://calderaforms.com/doc/caldera_forms_submit_return_redirect/
This file contains 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( 'caldera_forms_submit_return_redirect', 'my_redirect', 10, 4 ); | |
function my_redirect( $url, $form, $config, $processid ){ | |
global $transdata; | |
if ( ! empty( $transdata[ 'my_slug' ] ) && ! empty( $transdata[ 'my_slug' ][ 'url' ] ) ) { | |
return $transdata[ 'my_slug' ][ 'url' ]; | |
} | |
return $url; | |
} |
This file contains 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 | |
$returnurl = $referrer['scheme'] . '://' . $referrer['host'] . $referrer['path']; | |
$queryvars = array( | |
'cf_tp' => $processid | |
); | |
if(!empty($referrer['query'])){ | |
$queryvars = array_merge($referrer['query'], $queryvars); | |
} | |
$returnurl = add_query_arg( $queryvars, $returnurl ); |
This file contains 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 | |
global $transdata; | |
$transdata[ 'my_slug' ][ 'url' ] = 'https://someapi.com?key=whatever'; | |
return array( | |
'type' => 'success' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment