Skip to content

Instantly share code, notes, and snippets.

@azizulDev
Created November 14, 2022 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azizulDev/28102b86f8f3c0d6677916394cef9280 to your computer and use it in GitHub Desktop.
Save azizulDev/28102b86f8f3c0d6677916394cef9280 to your computer and use it in GitHub Desktop.
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param array $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
*
* @return array
*/
function custom_wpkses_post_tags( $tags, $context ) {
if ( 'post' === $context ) {
$tags['iframe'] = array(
'src' => true,
'height' => true,
'width' => true,
'frameborder' => true,
'allowfullscreen' => true,
);
}
return $tags;
}
add_filter( 'wp_kses_allowed_html', 'custom_wpkses_post_tags', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment