Last active
September 7, 2016 07:43
-
-
Save DavidCramer/2429e6c1c1eb6cbc8bccfdbbbc5982ff to your computer and use it in GitHub Desktop.
Remove cf_id= in Caldera Forms
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 this to your theme or child theme's functions.php file to | |
// remove the cf_id=x from redirect URLs on form submit | |
function cf_remove_cfid( $url ){ | |
if( false !== strpos( $url, '?' ) ){ | |
$parts = explode( '?', $url ); | |
parse_str( $parts[1], $query ); | |
if( isset( $query['cf_id'] ) ){ | |
unset( $query['cf_id'] ); | |
return $parts[0] . '?' . http_build_query( $query ); | |
} | |
} | |
return $url; | |
} | |
add_filter( 'caldera_forms_redirect_url', 'cf_remove_cfid', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment