Change gravity forms confirmation redirect query string to include entry id [closed]

I need to somehow insert the entry id from a Gravity Forms submission into a redirect confirmation. My problem is, that when attempting to create a confirmation via the admin interface, I can insert the entry id into a hidden field, but it doesn’t exist until after everything fires, rendering my query string blank (although the others do still work). I was thinking that by hooking into gform_confirmation, I would have access by grabbing the confirmation before it happened and changing it on the fly but that doesn’t seem to be working either. Here’s what I currently have entered into my functions.php:

add_action("gform_confirmation", "custom_confirm", 10, 4);
function custom_confirm($confirmation, $form, $lead, $is_ajax){

    $url = $confirmation . "&rma" . $lead['id'];

    $confirmation = array('redirect' => $url);


As you can see, I’m simply trying to tack on “&rma=[entry-id]” although I’m not sure $lead['id'] is even the right variable I need to be accessing. Also not sure if the last assignment is changing the URL in the proper way.

TL;DR: I need to change the confirmation redirect to include the entry ID and I’m wondering if it’s even possible.

1 Answer

I figured it out. I did have some syntax errors in my code. Should have been add_filter instead of add_action. Also, $confirmation is an array and was never returned. I think my brain was just tired from looking at this for so long. Anyways, here’s what I did to fix it.

add_filter("gform_confirmation", "confirm_change", 10, 4);
function confirm_change($confirmation, $form, $lead, $ajax){

    $url = get_bloginfo('url') ."/thank-you/?page=". $lead['1']. "&rma=" . ($lead['id']);

    $confirmation = array('redirect' => $url);
    return $confirmation;

Leave a Comment