Skip to content

Instantly share code, notes, and snippets.

@DavidCramer
Last active September 7, 2016 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidCramer/2429e6c1c1eb6cbc8bccfdbbbc5982ff to your computer and use it in GitHub Desktop.
Save DavidCramer/2429e6c1c1eb6cbc8bccfdbbbc5982ff to your computer and use it in GitHub Desktop.
Remove cf_id= in Caldera Forms
<?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