Skip to content

Instantly share code, notes, and snippets.

@Willem-Siebe
Created July 20, 2015 08:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Willem-Siebe/a30f4ba5ff3607923ebc to your computer and use it in GitHub Desktop.
Save Willem-Siebe/a30f4ba5ff3607923ebc to your computer and use it in GitHub Desktop.
Create unique Cred Frontend Editor url's after form submission so this can be tracked in Google Analytics. See https://wp-types.com/forums/topic/different-thank-you-pages-in-cred-depending-on-the-url-parameter/#post-263521, because you need to add more code to your CRED form!
// Add parent page ID's to the thank you pages after form submission through CRED forms. More code needs to be added in CRED form itself, see https://gist.github.com/Willem-Siebe/a30f4ba5ff3607923ebc.
add_shortcode('wsis-sc-get-url-param', 'wsis_get_url_param');
function wsis_get_url_param ($atts) {
$var = $atts["var"];
return $_GET[$var];
}
function wsis_add_parent_page_id_to_redirect_page($url, $post_id, $form_data)
{
$parent_page_id = $_POST["parent_page_id"];
if(!empty($parent_page_id)) {
return $url .= '?parent_page_id='.$parent_page_id;
}
return $url;
}
add_filter('cred_success_redirect', 'wsis_add_parent_page_id_to_redirect_page',10,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment