bookmark_bordergform_include_thousands_sep_pre_format_number

Description

Use this filter to prevent the thousand separator being included when the number field value is formatted for display in the admin, notifications and confirmations.

Usage

add_filter( 'gform_include_thousands_sep_pre_format_number', 'your_function_name', 10, 2 );

Parameters

  • $include_seperator boolean

    Should the thousand separator be included. Default is true.

  • $field Field Object

    The field that is currently being processed.

Examples

1. All fields and forms

This example shows how you can disable the thousand separator for all number fields on all forms.

add_filter( 'gform_include_thousands_sep_pre_format_number', '__return_false' );

2. Specific field

This example shows how you can disable the thousand separator for a specific field.

add_filter( 'gform_include_thousands_sep_pre_format_number', function ( $include_seperator, $field ) {
    return $field->formId == 2 && $field->id == 5 ? false : $include_seperator;
}, 10, 2 );

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in the following methods in includes/fields/class-gf-field-number.php

  • GF_Field_Number::get_field_input()
  • GF_Field_Number::get_value_entry_list()
  • GF_Field_Number::get_value_entry_detail()
  • GF_Field_Number::get_value_merge_tag()