Home › Forums › General Issues › Removing Non-Numeric Characters from ACF Form › Reply To: Removing Non-Numeric Characters from ACF Form
There are very few reasons that I can see to cause your validation not to work is that this code is never called or it is called after the hook is actually run.
add_filter('acf/validate_value/name=sell_price', 'allow_only_floats', 20, 4);
add_filter('acf/validate_value/name=buy_price', 'allow_only_floats, 20, 4);
Another possibility is that the names you are using are not the names you need to use. This would be the case if these fields are sub fields in a group, repeater or flexible content field. Have you tried using the field key variation of these hooks?
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!
ACF’s Repeater field is a versatile solution for repeating content in #WordPress.
— Advanced Custom Fields (@wp_acf) December 29, 2022
What’s your favorite use case for the Repeater field?
What’s the weirdest thing you’ve ever used it for?
Let us know!👇
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.