The documentation page about this filter ‘gform_confirmation’ provides different situation examples for using it correctly.
add_filter(‘gform_confirmation’, ‘custom_confirmation’, 10, 4);
add_filter(‘gform_confirmation_4’, ‘custom_confirmation’, 10, 4);
function custom_confirmation($confirmation, $form, $entry, $ajax) {
GFCommon::log_debug(‘gform_confirmation: running.’);$url = esc_url_raw($confirmation[‘redirect’]);
GFCommon::log_debug(__METHOD__ . ‘(): Redirect to URL: ‘ . $url);
$confirmation = ‘Thanks for contacting us! We will get in touch with you shortly.’;
$confirmation .= GFCommon::get_inline_script_tag(“window.open(‘$url’, ‘_blank’);”);return $confirmation;
};