Support

Account

Home Forums General Issues 6.2.7 and acf_add_allowed_iframe_tag

Helping

6.2.7 and acf_add_allowed_iframe_tag

  • As I prepare for the changes in 6.2.7 I’m investigating sites to see what will break. First I added this code to my functions.php file:

    add_filter( 'acf/the_field/escape_html_optin', '__return_true' );

    to force the sites to use the upcoming changes. I found this code in this article ACF 6.2.5 Security Release.

    Knowing that there are pages on numerous sites that have Google Maps in an iframe, I looked for a way to allow that.

    I found this article ACF | HTML Escaping. At the bottom of the page it offers code for allowing iframes in ACF fields.

    With the code to force early adoption of 6.2.7, the Google Maps iframes don’t show on pages that should have them. That’s what I expect, however, when I add the code:

    add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_iframe_tag', 10, 2 );
    function acf_add_allowed_iframe_tag( $tags, $context ) {
        if ( $context === 'post' ) {
         $tags['iframe'] = array(
             'src'          => true,
             'height'       => true,
             'width'        => true,
             'frameborder'  => true,
             'allowfullscreen' => true,
         );
        }
    
        return $tags;
    }

    which should allow iframes, it still does not show. Can someone please tell me why this is not working?

    Thank you.

  • Did you figure out a solution? I’m having the same problem.

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

You must be logged in to reply to this topic.