How to Use Formidable Hooks

Any time you add code, either insert it in your theme functions.php or a new plugin. The Code Snippets plugin is also a great option. If you want to insert code into your theme functions.php, but aren’t sure where to put it, add it at the very end of the file, before the last ?> if there is one. If you plan to update your theme, be sure to put it in a new plugin so it won’t be lost on update.

IMPORTANT: Before making any PHP changes, make sure you have FTP access so you can still access your site if there are any mistakes in your code.

If you’re not familiar with using WordPress filters, you can find more details in the WordPress codex.

Create a Form

frm_available_fields: Add or remove available basic fields (array)

frm_pro_available_fields: Add or remove available Pro fields (array)

frm_before_field_created: Change field settings before the field is added to your form.
Parameters: $current_field (array), $form_id (string)

Form Appearance

frm_custom_html: Change the default HTML before a field is created.

frm_submit_button: Change the label of the submit button before it’s displayed.

frm_field_type: Change the field type before it is displayed in your form.

frm_field_classes: Add classes to an input field.

frm_get_paged_fields: Display the same field multiple times in the same multi-paged form.

frm_form_fields_class: Add a class to a single form or all forms on your site.

frm_replace_shortcodes: Filter custom shortcodes in the custom HTML.
Parameters: $html (string), $field (array)

frm_display_form_action: Do something before the form is displayed. You can use this action to determine whether to display to form or not.

frm_form_classes: Add classes in the form tag.

frm_submit_button_action: Add HTML into the submit button.

frm_field_input_html: Add HTML within the input tags.

frm_date_field_js: Customize the datepicker.

frm_entries_footer_scripts: Add javascript to the footer of your form.

Field Values

frm_get_default_value: Set a default value in PHP when your form is displayed.

frm_data_sort: Change the order of the options in a data from entries field.

frm_setup_new_fields_vars: Change the field value or options or any other field-specific option.

frm_setup_edit_fields_vars: Change the field value or options or any other field-specific option when editing an entry.
Parameters: $values (array), $field (object), $entry_id (integer)

frm_field_value_saved: Set a different input value before the form is displayed.
Parameters: $option_name (string), $opt_key (string), $field (array)

Entry Management (create, update, delete)

frm_after_create_entry: Do something with the posted data.

frm_after_update_entry: Do something with the posted data when the form is being updated.

frm_before_destroy_entry: Before the entry is destroyed.

frm_validate_field_entry: Add custom errors here.

frm_validate_entry: Add custom errors here if they are not specific to one field.

frm_add_entry_meta: Make changes to a value saved to a field right before it is sent to the database.

frm_upload_folder: Change the subfolder where form uploads are sent.

frm_user_can_edit: Make changes to who is allowed to edit entries from the front-end.

frm_redirect_url: Dynamically change the URL the user is redirected to.

frm_csv_filename: Customize the filename of your exported CSV.

Customize the Email Notification

frm_email_value: Change/format a value in the email before sending.

frm_email_header: Customize headers for your email notifications.

frm_to_email: Add or remove email addresses for notification.

frm_email_subject: Customize your email subject.

frm_notification_attachment: Attach files to the email notification.

Display Data

frm_where_filter: Customize the value of an option selected in the where options of a custom display.

frmpro_fields_replace_shortcodes: Change the value displayed in emails, custom displays, or anywhere else the field ID shortcodes are used.

frm_show_entry_dates: Customize which dates an entry will show on in a calendar custom display.

frm_graph_value: Change the value used in the graphs