Skip to content

Instantly share code, notes, and snippets.

@mjones129
Last active March 29, 2024 14:37
Show Gist options
  • Save mjones129/72794441b43d2e5d583829dec71511d8 to your computer and use it in GitHub Desktop.
Save mjones129/72794441b43d2e5d583829dec71511d8 to your computer and use it in GitHub Desktop.
Fix ACF Version 6.2.7 Security Release (add to functions.php)
<?php
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['iframe'] = array(
'src' => true,
'height' => true,
'width' => true,
'frameborder' => true,
'allowfullscreen' => true,
);
$tags['script'] = array(
'type' => true,
'src' => true,
'defer' => true,
'async' => true,
);
$tags['p'] = array();
$tags['a'] = array(
'href' => true,
'title' => true,
);
}
return $tags;
}
//jon's acf fix for blocks theme
add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) {
            if ( $selector === "wysiwyg" || $selector === "eyebrow" ) return true;
            return $allowed;
      }, 10, 2);
      
      
      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;
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment