I want to redirect based on conditions in Gravity Forms.

add_filter( 'gform_confirmation_17', __NAMESPACE__ . '\\redirectfilter', 10, 4 );
function redirectfilter($confirmation, $form, $entry, $ajax) {
    GFCommon::log_debug( __METHOD__ . '(): started.' );

    $laatste = $entry['1'];

    if(isset($_SESSION['form'])) {
        GFCommon::log_debug( __METHOD__ . '(): SESSION[form] is set.' );
        $result = array();

        foreach($_SESSION['form'] as $row){
            $result[] = $row;

        if ($result[0] === 'Diesel' &&  $result[1] === 'Mobiel' && $laatste === 'Kunststof'  ) {

            GFCommon::log_debug( __METHOD__ . '(): Diesel and Mobiel and Kunststof' );

            $confirmation = array('redirect' => esc_url(home_url('/producten/filters/brandstof/diesel/materiaal/kunststof/toepassing-filter/mobiel/')));
        } else {
            $confirmation = "Geen producten gevonden aan jouw criteria";


    GFCommon::log_debug( __METHOD__ . '(): finished.' );
    return $confirmation;       

But I cant seem to get it to work, I have the feeling i'm missing something but I can't find it :/

You can find my Gravity Forms log here: http://pastebin.com/hm5RYpyZ.

Help will be greatly appreciated.

Best Regards,

Dylan Smit

1 Answer 1


I think there is no need for this approach. You should try this:

  1. Go to Form editor / Confirmations
  2. Create confirmation
  3. At the bottom of the screen you can find Conditional Logic, from there you can select specific field values.
  4. Set Confirmation Type as Redirect

Repeat process for all Confirmation options / redirects you need to offer.

enter image description here

  • Didn't know i could use it like this! Thank you very much!
    – Dylan Smit
    Jan 16, 2017 at 14:26
  • No problem, glad I could help. If you need anything else let me know! Jan 16, 2017 at 14:38
  • Is there a condition to check for already registered email?
    – m4n0
    Aug 4, 2020 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.