-
-
Save billerickson/7ebff6f2e44e27cd78de289e6535bd10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Include Form Fields on Confirmation URL | |
* @see https://www.billerickson.net/code/wpforms-pass-form-data-to-another-form/ | |
*/ | |
function be_wpforms_fields_on_confirmation( $url, $form_id, $fields, $form_data, $entry_id ) { | |
$classes = explode( ' ', $form_data['settings']['form_class'] ); | |
if( ! in_array( 'fields-to-confirmation', $classes ) ) | |
return $url; | |
$args = array(); | |
foreach( $fields as $field ) { | |
if( !empty( $field['value'] ) ) | |
$args['wpforms-' . $form_id . '-field_' . $field['id'] ] = $field['value']; | |
} | |
return esc_url_raw( add_query_arg( $args, $url ) ); | |
} | |
add_filter( 'wpforms_process_redirect_url', 'be_wpforms_fields_on_confirmation', 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment