Yep, sorry I should have made it clear, you would use this function in the filter the way you have it.
I’m pretty sure that my function is safe for all of the built in ACF field types, but I have not tested it with every type of field. There are a few add on fields that I know of that it may not be safe for. On the other hand, if I was using acf_form to allow users to submit content I’d be extremely careful about the types of field I allowed and in some cases I’d build my own validation to ensure that nothing noxious was submitted.
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!