Home › Forums › General Issues › Insert Commas into ACF number field › Reply To: Insert Commas into ACF number field
I am using a version of your code to format all the number fields:
add_filter('acf/format_value/type=number', 'fix_number', 30, 3);
function fix_number($value, $post_id, $field) {
$value = number_format($value);
return $value;
}
But it is also removing all the decimal places, what do I neeed to edit about this code to make it put thousand separators in but also keep the decimal places?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.