Created
February 28, 2024 08:27
-
-
Save w3b-beweb/0193f2d436c0ae43ac1d78b4cf9be80d to your computer and use it in GitHub Desktop.
Elementor Pro forms Retrieve a field value by id
This file contains hidden or 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 | |
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