[ad_1]
This reference has a bit more info on the function: https://developer.projectdmc.org/reference/functions/wp_kses_allowed_html/
Thanks @gappiah George. That is definitely a hint in the right direction!
From your link I learned that “post” is the most permissive and changing the context to “post” fixed the issue and let me iframes finally render dynamically from ACF fields 🙂
Looks like the codex had some good notes about the contexts and what each is for, but those didn’t get incorporated into the the API docs, but got attached as a user comment:
// strips all html (empty array)
$allowed_html = wp_kses_allowed_html( 'strip' );
// allows all most inline elements and strips all block level elements except blockquote
$allowed_html = wp_kses_allowed_html( 'data' );
// very permissive: allows pretty much all HTML to pass - same as what's normally applied to the_content by default
$allowed_html = wp_kses_allowed_html( 'post' );
// allows a list of HTML Entities such as
$allowed_html = wp_kses_allowed_html( 'entities' );
Super stoked this is working now!
Here is the code I ended up using for future reference:
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['script'] = array(
'src' => true,
'height' => true,
'width' => true,
'frameborder' => true,
'allowfullscreen' => true,
);
}
return $tags;
}`
