Support

Account

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().