diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 1381038418..a617cb0110 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -171,7 +171,12 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { */ function number_format_i18n( $number, $decimals = 0 ) { global $wp_locale; - $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); + + if ( isset( $wp_locale ) ) { + $formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] ); + } else { + $formatted = number_format( $number, absint( $decimals ) ); + } /** * Filter the number formatted based on the locale.