How to Use Formidable Hooks

Where to put the code

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.

Duplicating a function

If you are attempting to use the same function or hook multiple times, you can't just duplicate the code and change field ids. Using the same function name twice will result in fatal errors on your site. To avoid this issue, you must change the function name any time you use the same code more than once on your site.

The function name is typically in two places within the code and needs to be changed in both places it occurs. In this example, the function name "check_entry_count" would need to be changed to something unique like "check_entry_count2" or "check_formb_entry_count". As long as the function names are unique, you can use the same custom code multiple times.

add_action('frm_display_form_action', 'check_entry_count', 8, 3);
function check_entry_count($params, $fields, $form){
global $user_ID;
remove_filter('frm_continue_to_new', '__return_false', 50);
if($form->id == 11 and !is_admin()){ //replace 5 with the ID of your form
$count = FrmEntry::getRecordCount("form_id=". $form->id ." AND user_id=".$user_ID);
if($count >= 1){ //change 2 to your entry limit
echo 'This form is closed';
add_filter('frm_continue_to_new', '__return_false', 50);

Form Appearance

frm_scroll_offset: Add extra offset to the scrolling after form submit.


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_submit_button: Change the label of the submit button before it is displayed.

frm_submit_button_action: Add HTML into the submit button.


frm_form_classes: Add classes in the form tag.


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

frm_show_form_after_edit: Use if you would like the form show differently after edit than is does after submit.

frm_ajax_load_styles: If you have a style you would like loaded when a form is rendered with ajax, you can allow it with this hook.

frm_entry_form: This hook can be used to add anything, such as a field, to a form.


frm_entries_footer_scripts: Add javascript to the footer of your form.

get_frm_stylesheet: Use this hook to set a custom stylesheet for your forms.

Field Appearance

frm_repeat_start_rows: Set the number of rows to appear in a repeating field when the form is initially loaded.

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

frm_replace_shortcodes: Use this hook to change the HTML for any fields in your form.

frm_field_input_html: Add HTML within the input tags.



frm_field_classes: Add classes to an input field.

frm_file_icon: Use to alter the HTML for a file displayed with a file upload field when editing your form.

frm_selectable_dates: This hook allows you to manipulate specific dates within a date field.

frm_date_field_js: Customize the datepicker.


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



Field Options and Values

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.

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

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

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


frm_get_categories: This hook can be used to alter the category options returned in a Dynamic field.

frm_allowed_times: This example allows you to manipulate the available times for users to choose in a time field.




Entry Management


frm_validate_field_entry: Add custom errors here for a specific field.

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

frm_new_post: This hook is used to modify the post before it is created since version 2.0.

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

frm_after_create_entry: Do something with the posted data.

frm_upload_folder: Change the subfolder where form uploads are sent.

frm_delete_message: Use this hook to change the message shown after an entry is deleted from the front-end.

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

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


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

frm_before_destroy_entry: Do something before the entry is destroyed.

frm_pre_create_entry: This hook can be used to manipulate the values in an entry prior to it’s creation.



Customize the Email Notification

frm_to_email: Add or remove email addresses for notification.

frm_notification_attachment: Attach files to the email notification.

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

frm_email_subject: Customize your email subject.



Form Actions



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 in a calendar custom display.

frm_graph_value: Change the value used in the graphs.

frm_filter_where_val: This hook is similar to the frm_where_filter hook, but is fired earlier and changes only the value used before it is used in the full database query.




frm_filter_auto_content: Use this hook to prevent automatic filtering of a view used on a single post or page.

frm_google_chart: Use this hook to add or change the options in your Google chart.

frm_view_order: This hook allows you to manipulate how a view is ordered.


frm_before_display_content: Use this hook to customize the Before Content of a View.


frm_display_entry_content: Use this hook to customize content in your View.

frm_display_entries_content: Use this hook to customize content in your View.


Creating Add-ons

Add a new field: View examples for adding fields to the form builder.

Add a form setting:

Add a form action:

Add a tab in Global Settings:

CSV and XML Management

frm_map_csv_field: This hook can be used to automatically match the headers in your .csv file with the fields in your form.

frm_csv_sep: This hook can be used to manipulate the separator for checkboxes and other arrays in a .csv file.

frm_csv_line_break: This hook allows you to manipulate the line breaks in an .csv file.

frm_csv_date_format: This hook allows you to manipulate the format of date fields in an .csv file.




frm_csv_columns: This hook can be used to manipulate the columns that appear in .csv files that are exported.

frm_csv_filename: Customize the filename of your exported CSV.

frm_csv_where: Use this hook to determine which entries will be exported when you export a CSV file.


How to Use Formidable Hooks: