Skip to content

Instantly share code, notes, and snippets.

@slaFFik
Created February 22, 2021 15:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaFFik/6ff289cd9fa53b7c0ad8a221eb593d11 to your computer and use it in GitHub Desktop.
Save slaFFik/6ff289cd9fa53b7c0ad8a221eb593d11 to your computer and use it in GitHub Desktop.
WPForms: display a form under the confirmation message with or without user entered field values.
<?php
add_action(
'wpforms_frontend_output_success',
static function ( $form_data, $fields, $entry_id ) {
unset(
$_GET['wpforms_return'],
$_POST['wpforms']['id']
);
// If you want to preserve the user entered values in form fields - remove the line below.
unset( $_POST['wpforms']['fields'] );
// Actually render the form.
wpforms()->frontend->output( $form_data['id'] );
},
42,
3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment