Fluent Forms has lots and lots of hooks and filters. I have found the most useful and common hooks and filters and put them into a big list with examples and use cases for people to quickly find and reference.
Quick Links
fluentform_insert_response_data
This hook is used to modify the data from your form before it is saved to the database.
Some use cases could be:
- Pulling data dynamically from elsewhere in your website like custom fields
- Adding or subtracting information entered
- Calculating date of birth
Essentially anything that needs to be done server side, and you don’t want to be cached.
<?php add_filter('fluentform_insert_response_data', 'tct_my_function', 10, 3); function tct_my_function($formData, $formId, $inputConfigs) { if($formId != 1) { // Replace with your Form ID return $formData; } $input_email = $formData['email']; // change 'email' with your input field name return $formData; }
Copy
View all tutorials that use the fluentform_insert_response_data
hook
fluentform_rendering_field_data_{input_key}
This hook is used to modify the input data. This includes the actual input data and input settings.
Some use cases could be:
- Dynamically populating a select dropdown with external data
- Load ACF field data from the specific post
- Generate a random code with a PHP snippet
You need to replace {input_key}
with the field type that you want to use.
Field type examples:
- input_text
- input_number
- select
- address
<?php add_filter('fluentform_rendering_field_data_input_text', 'tct_my_function', 10, 2); function tct_my_function($data, $form) { if($form->id != 1) { return; } // Check if our field is equal to my_text_field if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'my_text_field') { return $data; } return $data; }
Copy
View all tutorials that use the fluentform_rendering_field_data
hook
Smartcodes
Smartcodes are used for dynamic data in the inputs default value
Smartcodes are made up of 2 hooks.
fluentform_editor_shortcodes
– For form editor listfluentform_all_editor_shortcodes
– For Email/Confirmation Settings listfluentform_shortcode_parser_callback_{smartcode_name}
– Transforming your data
Some use cases could be:
- Load ACF field data from the specific post
- Generate a random code with a PHP snippet
- Email confirmation data
You need to replace {smartcode_name}
with the name of your smartcode.
add_filter('fluentform_editor_shortcodes', function ($smartCodes) { $smartCodes[0]['shortcodes']['{my_own_smartcode}'] = 'My Own smartcode'; return $smartCodes; }); add_filter('fluentform_editor_shortcode_callback_my_own_smartcode', function ($value, $form) { $dynamicValue = $form->title; // Returns current form title. You can fetch any data and return it here. return $dynamicValue; }, 10, 2);
Copy
View all tutorials that use the fluentform_all_editor_shortcodes
hook