Is it possible to redirect to a page after submitting the smart form?

I am using the smart form and i want to redirect to a page after the form is submitted.
Now it redirects to the same page and it would be nice to redirect to a custom “thank you page”.
Is something like this possible when using the wp smart form?

Bump, I would love to know this as well

@beatngu (sorry for the delay) and @snowfeald,
It isn’t included as a smart form option, but you can add an If Option and PHP code from the WP Actions. I’m not sure if this is a sanctioned way to do this, as opposed to using wp_safe_redirect() or some other built-in WP function, but here is what I did.

  1. Directly after your smart form add a div with inline styling of “display: none;” Note - you can also do this by adding in a php block and typing by hand
  2. Add an If Option from the WP Actions
  3. For condition add $mailer->processed
  4. Add a PHP Code block from the WP Actions
  5. For function add echo '<script>window.location.href="redirect.to.here"</script> and replace the element

This will create the following output in your theme file:

<?php if ( $mailer->processed ) : ?>
       <?php echo '<script>window.location.href="https://google.com/"</script>' ?>
 <?php endif; ?>

Again, not sure if this is the “safe” way to do it. No url sanitization or checks, but…
Cheers,
Bob

Hi Rob, following the initial steps where you place the IF and php code block on an invisibile div didn’t work (returned a php error so perhaps I was doing it wrong); so I simply pasted your theme output code below the smart form which worked excellently :smiley:

There’s an initial delay where the page will refresh for 100-300ms before redirecting to whatever href is set - but that’s alright as I don’t think anyone will care.

Excellent work as always Rob! This definitely looks something that could’ve been quickly googled but I don’t have much time to do that right now, so I really appreciate your prompt replies mate!

No problem - not much to be done about the delay, that is how long the mailer takes.

Chaining commands in Pinegrow is fairly powerful, it just takes a little bit of mind-chanage from how it is normally done with writing code.