Home › Forums › Front-end Issues › ACF Form Allow Script Tags for a Specific Field › Reply To: ACF Form Allow Script Tags for a Specific Field
No, this cannot be done for one field, you would need to allow scripts in all fields as described in this document https://www.advancedcustomfields.com/resources/html-escaping/
It might be possible to do this using an acf/save_post action with a priority of < 10 so that it runs before ACF saves the values.
In this action you would need to get the submitted value from $_POST[‘acf’], you would need to save this value by bypassing ACF entirely by using WP meta functions and then delete the value from $_POST[‘acf’].
However, this would only let you save the value, ACF will still not display the value on the front end to be edited after save without allowing script tags to be shown as I mentioned at the beginning. The only way to completely bypass wp_kses without allowing scripts in every field is to use a field that is not created by or managed by ACF. This might be possible by inserting a form field that you deal with yourself in an acf/save_post action by using either the “html_before_fields” or the “html_after_fields” arguments for acf_form().
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.