Support

Account

Home Forums General Issues Escaping Fields exception Reply To: Escaping Fields exception

  • This is solving the issue:

    if ( ! function_exists( 'acf_kses_post' ) ) :
    
        function acf_kses_post( $value, $post_id = '', $field = '' ) {        
            
            // exception for option header and footer code
            $header_code = get_field_object('header_code', 'option');
            $footer_code = get_field_object('footer_code', 'option');
            
            if( $field['key'] == $header_code['key'] || $field['key'] == $footer_code['key'] ) {
                return $value;
            }
            
            // escaping all fields  
            if( is_array( $value ) ) {
                return array_map('acf_kses_post', $value);
            }
    
            return wp_kses_post( $value );
    
        }
    
    endif;
    
    add_filter('acf/update_value', 'acf_kses_post', 10, 4);