Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active September 12, 2018 17:04
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/0cecaac0b7218392ea41f980c79f49e9 to your computer and use it in GitHub Desktop.
Save billerickson/0cecaac0b7218392ea41f980c79f49e9 to your computer and use it in GitHub Desktop.
<?php
/**
* WPForms encoded query string
* @author Bill Erickson
* @see https://www.billerickson.net/code/wpforms-encoded-query-string/
*
*/
function be_wpforms_encoded_query_string( $field_id, $field_submit, $form_data ) {
if ( empty( $field_submit ) || 'encoded' !== $form_data['fields'][ $field_id ]['css'] ) {
return;
}
wpforms()->process->fields[ $field_id ]['value'] = sanitize_text_field( base64_decode( $field_submit ) );
}
add_action( 'wpforms_process_format_hidden', 'be_wpforms_encoded_query_string', 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment