Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 19, 2025 14:21
Show Gist options
  • Select an option

  • Save andrewlimaza/8252d11521ebf85f2cfc0d8aa61110e0 to your computer and use it in GitHub Desktop.

Select an option

Save andrewlimaza/8252d11521ebf85f2cfc0d8aa61110e0 to your computer and use it in GitHub Desktop.
Allow <iframe> in content around wp_kses_post functions
<?php
/**
* Allow <iframe> code in wp_kses_post calls.
* Useful for embedding videos in Memberlite theme banner descriptions.
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_allow_iframe_wp_kses_post( $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', 'my_pmpro_allow_iframe_wp_kses_post', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment