How to Fix ACF the_field Issues and Securely Use ACF

4 Comments

  1. I am not able to get this to work for ‘the_sub_field’. Two messages in the admin section –
    ‘section_text (field_name_1) – rendered via the_sub_field’
    ‘section_text (field_name_2) – rendered via the_sub_field’

    Added the suggested filter:

    add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) {
    if ( $selector === "field_name_1" || $selector === "field_name_2" ) {
    return true;
    }
    return $allowed;
    }, 10, 2);

    It removed the message for the first field but not the second field. Any suggestions?

    1. Bryan Hoffman

      Hi Leslie,

      That looks like it should work. If you swap the $selector check (so field_name_2 comes first) does it remove the message for the second?

  2. Tried swapping field_1 for field_2 but I still get the message for only the second field (field_name_2). Message –
    section_text (field_name_2) – rendered via the_sub_field

    1. Bryan Hoffman

      Hmm, interesting. Reach out to me at support@cinchws.com and we can likely take a closer look. Or hit me up on the chat during the day.

Comments are closed.