› Redirect all Gravity Forms submissions to a custom confirmation page

Redirect all Gravity Forms submissions to a custom confirmation page

Email this to someoneShare on Facebook0Share on Google+0Share on LinkedIn0Share on Tumblr0Share on StumbleUpon0Tweet about this on TwitterShare on Reddit0Pin on Pinterest0

The Gravity Forms settings panel lets you set a custom confirmation message or redirection URL for each form. Unfortunately, if your site has a bunch of forms, it can be quite tedious to change the confirmation for each one.

The gform_confirmation filter gives us a bulk method to override the confirmation for each form automatically, with just a few lines of code.

<?php
// custom confirmation for all gravity form submissions
// redirects all confirmations to custom URL
function new_gf_confirmation($confirmation, $form, $lead, $ajax){
	$confirmation = array('redirect" =>'http://www.example.com/');
	return $confirmation;
	}
add_filter('gform_confirmation', 'new_gf_confirmation', 10, 4);

Drop this code into your theme’s functions.php file to automatically configure a redirect URL for each form. Be sure to replace example.com with your custom redirect URL.

Subscribe for weekly tutorials