Check for a correct answer

add_filter(‘frm_validate_field_entry’, ‘check_correct_answer’, 10, 3); function check_correct_answer( $errors, $posted_field, $value ) { $target_field_id = 1248; // change 1248 to the ID of the field to check $expected_answer = ‘Answer 1’; // change ‘Answer 1’ with the expected answer if ( $target_field_id…Continue reading

Allow switching from NPS to Text field

add_filter(‘frm_switch_field_types’, ‘frm_switch_nps_to_text_field’, 10, 2); function frm_switch_nps_to_text_field( $field_types, $args ) { if ( ‘nps’ === $args[‘type’] ) { $field_types[‘text’] = $args[‘field_selection’][‘text’]; } return $field_types; }Continue reading

Remove errors in the admin

add_filter(‘frm_validate_entry’, ‘remove_errors_in_admin_area’, 20, 2); function remove_errors_in_admin_area($errors, $values){ if ( $values[‘form_id’] == 99 && is_admin() ) { //Change 99 to the ID of your form return array(); } return $errors; }Continue reading

Set the default value of a calculated field

add_filter( ‘frm_get_default_value’, ‘add_a_value_to_default’, 10, 5 ); function add_a_value_to_default( $new_value, $field, $dynamic_default, $allow_array, $args = array() ) { if ( ! empty( $args[‘is_calc’] ) ) { $new_value = 500; } return $new_value; }Continue reading

Add extra custom HTML to start page

add_filter(‘frm_chat_start_page_content’, ‘frm_chat_add_html’, 10, 2); function frm_chat_add_html( $start_page_content, $args ) { $target_form_id = 310; // change 310 to your form ID. if ( $target_form_id === (int) $args[‘form’]->id ) { $start_page_content .= ‘<br>’; $start_page_content .= ‘Additional start page content’; } return $start_page_content;…Continue reading

Add gallery to WooCommerce product

add_action(‘frm_after_create_entry’, ‘frm_add_gallery_to_product’, 60, 2); function frm_add_gallery_to_product( $entry_id, $form_id ) { if ( $form_id == 1705 ) {// Replace 1705 with the ID of your form $entry = FrmEntry::getOne( $entry_id ); if ( ! $entry->post_id ) { return; } update_post_meta($entry->post_id, ‘_product_image_gallery’,…Continue reading

Exclude a specific field from a summary field

add_filter( ‘frm_pro_fields_in_summary_values’, ‘exclude_field_from_summary’, 10, 2 ); function exclude_field_from_summary( $fields, $args ) { $target_form_id = 302; // Replace 302 with ID of your form if ( $target_form_id !== (int) $args[‘form_id’] ) { return $fields; } $field_id_to_remove = 1460; // Replace 1460…Continue reading

Set filename for CSV email attachment

add_filter(‘frm_csv_filename’, ‘change_csv_filename_attachment’, 10, 3); function change_csv_filename_attachment( $filename, $form, $args ) { if ( empty( $args[‘meta’] ) ) { return $filename; } $target_action_id = 158; // change 158 with the email form action ID $meta = $args[‘meta’]; if ( ! empty(…Continue reading