gform_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_separator 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_separator, $field ) {
	return $field->formId == 20 && $field->id == 45 ? false : $include_separator;
}, 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()