Add custom CSS class to each option

add_filter( ‘frm_images_dropdown_option_classes’, ‘add_css_class_image_dropdown’, 10, 2); function add_css_class_image_dropdown( $classes, $args ) { $classes .= ‘ your-custom-class’; return $classes; }Continue reading

Open forms on certain days and times

add_action( ‘frm_display_form_action’, ‘frm_open_hours_and_days’, 8, 3 ); function frm_open_hours_and_days( $params, $fields, $form ) { remove_filter( ‘frm_continue_to_new’, ‘__return_false’, 50 ); if ( ! in_array( $form->id, array( 214, 216, 217 ) ) || is_admin() ) { //replace 214, 216, 217 with the ids…Continue reading

Adjust temporary files deletion period

add_filter(‘frm_delete_temp_files_period’, ‘adjust_temp_files_deletion_period’); function adjust_temp_files_deletion_period( $period ) { // default is -3 hours return ‘-30 minutes’; // minimum life span of a file }Continue reading

converts a specific meta key to an integer

add_filter( ‘rest_prepare_frm_entries’, ‘my_custom_function’ ); function my_custom_function( $response ) { $meta_key = ‘5a4m0’; // change this to the meta key that needs to be converted to an integer. if ( isset( $response->data ) && ! empty( $response->data[‘meta’] ) && isset( $response->data[‘meta’][…Continue reading

Exclude fields by id

add_filter( ‘frm_quiz_score_field’, ‘exclude_fields_from_quiz_score’, 10, 2 ); function exclude_fields_from_quiz_score( $count_field, $args ) { $fields_to_exclude = array( 2504, 2505, 2506 ); // List the ids of the fields you want to exclude from the quiz score. if ( in_array( $args[‘field’]->id, $fields_to_exclude )…Continue reading

Hide legend in geo chart

add_filter(‘frm_google_chart’, ‘frm_legend_geo_graph’, 10, 2); function frm_legend_geo_graph( $options, $args ) { $options[‘legend’] = ‘none’; return $options; }Continue reading

Save the WooCommerce billing details to fields

add_action( ‘woocommerce_new_order_item’, ‘add_order_id_to_entry’, 10, 3 ); function add_order_id_to_entry( $item_id, $cart_item, $order_id ) { // check if there’s form data to process if ( empty( $cart_item->legacy_values[‘_formidable_form_data’] ) ) { return; } // get form entry $entry = FrmEntry::getOne( $cart_item->legacy_values[‘_formidable_form_data’] ); if…Continue reading

Capture timestamp

add_action( ‘frm_after_create_entry’, ‘my_custom_function’, 30, 2 ); function my_custom_function( $entry_id, $form_id ){ $entry = FrmEntry::getOne( $entry_id ); // Get the created_at date in a UNIX timestamp $timestamp = strtotime( $entry->created_at ); }Continue reading

Save api response for repeater

add_action( ‘frm_after_create_entry’, ‘frm_save_api_response_for_repeater’, 10, 2 ); function frm_save_api_response_for_repeater( $entry_id, $form_id ) { $target_child_form_id = 99; // change 99 to the ID of the child form if ( $target_child_form_id == $form_id ) { $repeater_field_id = 123; // change 123 to the…Continue reading