Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save w3b-beweb/0193f2d436c0ae43ac1d78b4cf9be80d to your computer and use it in GitHub Desktop.
Save w3b-beweb/0193f2d436c0ae43ac1d78b4cf9be80d to your computer and use it in GitHub Desktop.
Elementor Pro forms Retrieve a field value by id
<?php
add_action( 'elementor_pro/forms/process', function( $record, $ajax_handler ) {
//make sure its our form
$form_name = $record->get_form_settings( 'form_name' );
if ( 'Name of the form' !== $form_name ) {
return;
}
$field = $record->get_field( ['id' => 'some_piece_of_info'] );
// ___remember to sanitize user submitted values before using!!!___
$field_value = $field['some_piece_of_info']['value'];
/* $field Array structure and content
[some_piece_of_info] => Array
(
[id] => some_piece_of_info
[type] => text
[title] => the title
[value] => filtered value
[raw_value] => unfiltered value
[required] => 1
)
*/
}, 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment