Home › Forums › General Issues › Insert Commas into ACF number field › Reply To: Insert Commas into ACF number field
hello guys,
this was a helpful post, but it doesnt quite solve my issue. I have two fields that I would like to add commas. This might be a silly questions, but I am an extreme novice when it comes to PHP.
I would like to add commas to “price” and the other is “square_footage”.
The issue I am coming across is when I put both fields “price” & “square_footage”, I get an error, but if I only enter one, it works fine. What am I missing here?
add_filter('acf/format_value/name=price', 'fix_number', 20, 3);
function fix_number($value, $post_id, $field) {
$value = number_format($value);
return $value;
}
add_filter('acf/format_value/name=square_footage', 'fix_number', 20, 3);
function fix_number($value, $post_id, $field) {
$value = number_format($value);
return $value;
}
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.