Home / Admin / Display Form After Confirmation
Duplicate Snippet

Embed Snippet on Your Site

Display Form After Confirmation

Displays the form again after submission and below the confirmation message. Change the 999999 to match your own form ID. See https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ to find your form ID.

100+
Code Preview
php
<?php
/**
 * Display form after confirmation
 *
 * @link https://wpforms.com/developers/how-to-display-the-confirmation-and-the-form-again-after-submission/
 * 
 * For support, please visit: https://www.facebook.com/groups/wpformsvip
 */
  
function wpf_dev_frontend_output_success(  $form_data, $fields, $entry_id ) {
       
    // Only process this snippet on form ID 999999
    // To find your form or field ID, visit https://wpforms.com/developers/how-to-locate-form-id-and-field-id/
    if ( absint( $form_data[ 'id' ] ) !== 999999 ) {
        return;
    }
                // Reset the fields to blank
        unset(
            $_GET[ 'wpforms_return' ],
            $_POST[ 'wpforms' ][ 'id' ]
        );
 
        // Uncomment this line out if you want to clear the form field values after submission
        unset( $_POST[ 'wpforms' ][ 'fields' ] );
 
        // Actually render the form.
        wpforms()->frontend->output( $form_data[ 'id' ] );
  
}
 
add_action( 'wpforms_frontend_output_success', 'wpf_dev_frontend_output_success', 10, 3 );

Comments

Add a Comment