Filter hook 'number_format_i18n'

in WP Core File wp-includes/functions.php at line 444

View Source

number_format_i18n

Filter Hook
Description
Filters the number formatted based on the locale.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 444

Hook Parameters

Type Name Description
string $formatted Converted number in string format.
float $number The number to convert based on locale.
int $decimals Precision of the number of decimal places.

Usage Examples

Basic Usage
<?php
// Hook into number_format_i18n
add_filter('number_format_i18n', 'my_custom_filter', 10, 3);

function my_custom_filter($formatted, $number, $decimals) {
    // Your custom filtering logic here
    return $formatted;
}

Source Code Context

wp-includes/functions.php:444 - How this hook is used in WordPress core
<?php
 439  	 *
 440  	 * @param string $formatted Converted number in string format.
 441  	 * @param float  $number    The number to convert based on locale.
 442  	 * @param int    $decimals  Precision of the number of decimal places.
 443  	 */
 444  	return apply_filters( 'number_format_i18n', $formatted, $number, $decimals );
 445  }
 446  
 447  /**
 448   * Converts a number of bytes to the largest unit the bytes will fit into.
 449   *

PHP Documentation

<?php
/**
	 * Filters the number formatted based on the locale.
	 *
	 * @since 2.8.0
	 * @since 4.9.0 The `$number` and `$decimals` parameters were added.
	 *
	 * @param string $formatted Converted number in string format.
	 * @param float  $number    The number to convert based on locale.
	 * @param int    $decimals  Precision of the number of decimal places.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.