Home Forums Backend Issues (wp-admin) ACF Latest Update Select Field with Stylized UI Not Rendering HTML


ACF Latest Update Select Field with Stylized UI Not Rendering HTML

  • Hi, after upgrading ACF into the latest version, HTML inside select field with stylized UI are not rendered, is this something related to the latest security update of the plugin?

    Here is my client code:

    function acf_load_style_field_choices( $field ) {
    	if ( 'post_type_name' == get_post_type() ) {
    		$field['choices'] = array();
    		if( have_rows('option_field_name', 'option') ) {
    			while( have_rows('option_field_name', 'option') ) {
    				$value = get_sub_field('sub1');
    				$label = get_sub_field('sub2');
    				$field['choices'][ $value ] = '<span style="font-style: italic;">'.$label.'</span>';
    		return $field;
    add_filter('acf/load_field/name=field_name', 'acf_load_style_field_choices');
  • I’m running into the same issue, I’ve added an image via filter to make it easier to connect products with another post type. I’ve tried

    add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_iframe_tag', 10, 2 );
    function acf_add_allowed_iframe_tag( $tags, $context ) {
        if ( $context === 'acf' ) {
            $tags['img'] = array(
                'src'             => true,
                'height'          => true,
                'width'           => true,
                'alt'   		  => true,
                'class'   		  => true
        return $tags;

    to allow img tags, but this does not change anything. Any option, to deactivate this security feature completely? I’m the only one working on this page, so I don’t need any filters, I can care of these things myself. 🤐

    For the moment I’ve downgraded to 5.9.9. again

  • Same problem here. Didn’t find a filter or anything to avoid escaping HTML inside Select2 fields. But there’s another thread with an answer from a developer:


  • I use this to remove HTML temporary, until a patch is here

    add_filter( 'acf/load_field/type=select', function( $field ) {
        if ( is_array( $field['choices'] ) )
            array_walk_recursive( $field['choices'], function( &$value, $key ) {
                $value = wp_strip_all_tags( $value );
            } );
        return $field;
    } );
  • Hey everyone,

    We’re aware of this issue should have it patched in a release in the coming days!

    You’re right that it’s being escaped, but we’re going to allow some safe HTML back into select2 fields to solve this.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.