Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Keep Gravity Forms Displayed After Submission
// Allow the Gravity form to stay on the page when confirmation displays.
add_filter( 'gform_pre_submission_filter', 'dw_show_confirmation_and_form' );
function dw_show_confirmation_and_form( $form ) {
$shortcode = '[gravityform id="' . $form['id'] . '" title="true" description="false"]';
if ( array_key_exists( 'confirmations', $form ) ) {
foreach ( $form['confirmations'] as $key => $confirmation ) {
$form['confirmations'][ $key ]['message'] = $shortcode . '<div class="confirmation-message">' . $form['confirmations'][ $key ]['message'] . '</div>';
}
}
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.