Created
December 19, 2025 14:21
-
-
Save andrewlimaza/8252d11521ebf85f2cfc0d8aa61110e0 to your computer and use it in GitHub Desktop.
Allow <iframe> in content around wp_kses_post functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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