Action Hook Integration
The Action Hook field enables you to add custom functionality to your forms using WordPress actions.
Setup
- Add Action Hook field to your form:
- Drag the “Action Hook” field from the form builder
- Set a unique action hook name (e.g., ‘my_custom_form_action’)
- Add description for documentation
Example Usage
// Hook into your custom action
add_action('my_custom_form_action', 'my_custom_function', 10, 4);
function my_custom_function($post_id, $attributes, $field, $form_settings) {
// $post_id: Current post ID
// $attributes: Form attributes array
// $field: Current field settings
// $form_settings: Complete form settings array
// Example: Add custom meta to post
echo 'your custom code here';
}
Available Parameters
$post_id
(int): Current post ID$attributes
(array): Form attributes and settings$field
(array): Current field configuration$form_settings
(array): Complete form settings