Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created February 28, 2019 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/29545e58e91cc56abc3065f127e21698 to your computer and use it in GitHub Desktop.
Save billerickson/29545e58e91cc56abc3065f127e21698 to your computer and use it in GitHub Desktop.
<?php
/**
* Include Specific Form Fields on Confirmation URL
*
*/
function ea_wpforms_include_form_fields_on_confirmation( $url, $form_id, $fields ) {
$args = array();
$fields_to_include = array( 1, 4, 8 );
foreach( $fields as $field ) {
if( !empty( $field['value'] ) && in_array( $field['id'], $fields_to_include ) )
$args['field_' . $field['id']] = $field['value'];
}
return esc_url_raw( add_query_arg( $args, $url ) );
}
add_filter( 'wpforms_process_redirect_url', 'ea_wpforms_include_form_fields_on_confirmation', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment